From cd8a0e6b8e68b1f5653a7204f6c6940ce1c38a47 Mon Sep 17 00:00:00 2001 From: p-wysocki Date: Tue, 30 Aug 2022 19:31:55 +0200 Subject: [PATCH] Fix ONNX compatibility and numpy warnings --- src/bindings/python/requirements_test.txt | 2 +- .../tests/test_frontend/test_frontend_onnx.py | 20 +++++++++---------- .../python/tests/test_graph/test_basic.py | 2 +- .../python/tests/test_graph/test_create_op.py | 16 +++++++-------- .../python/tests/test_graph/test_if.py | 14 ++++++------- .../python/tests/test_graph/test_loop.py | 6 +++--- .../python/tests/test_graph/test_ops.py | 2 +- .../tests/test_graph/test_ops_binary.py | 14 ++++++------- .../python/tests/test_graph/test_reduction.py | 2 +- .../python/tests/test_graph/test_utils.py | 10 ++++------ .../tests/test_onnx/test_ops_logical.py | 6 +++--- .../tests/test_onnx/utils/model_importer.py | 4 ---- .../tests/test_runtime/test_infer_request.py | 4 ++-- .../python/tests/test_runtime/test_tensor.py | 12 +++++------ .../python/tests/test_runtime/test_type.py | 2 +- .../test_transformations/test_pattern_ops.py | 6 +++--- 16 files changed, 58 insertions(+), 64 deletions(-) diff --git a/src/bindings/python/requirements_test.txt b/src/bindings/python/requirements_test.txt index 2c82347a91c..b6221e6215d 100644 --- a/src/bindings/python/requirements_test.txt +++ b/src/bindings/python/requirements_test.txt @@ -23,7 +23,7 @@ flake8_pep3101 flake8_quotes import-order mypy -onnx<1.12.0 +onnx<=1.12.0 Pep8-naming pydocstyle pytest-xdist diff --git a/src/bindings/python/tests/test_frontend/test_frontend_onnx.py b/src/bindings/python/tests/test_frontend/test_frontend_onnx.py index 6c091ef5bcb..2d6e7f5e10c 100644 --- a/src/bindings/python/tests/test_frontend/test_frontend_onnx.py +++ b/src/bindings/python/tests/test_frontend/test_frontend_onnx.py @@ -75,15 +75,15 @@ def create_onnx_model_with_custom_attributes(): attribute_i32=np.int32(10), attribute_i64=np.int64(10), attribute_str="string", - attribute_f32=np.float(10), + attribute_f32=float(10), attribute_f64=np.float64(10), - attribute_bool=np.bool(True), + attribute_bool=True, attribute_type=onnx.TensorProto.INT32, attribute_list_i32=np.array([1, 2, 3], dtype=np.int32), attribute_list_i64=np.array([1, 2, 3], dtype=np.int64), - attribute_list_str=np.array(["a", "b", "c"], dtype=np.str), - attribute_list_f32=np.array([1, 2, 3], dtype=np.float), + attribute_list_str=np.array(["a", "b", "c"], dtype=str), + attribute_list_f32=np.array([1, 2, 3], dtype=float), attribute_list_f64=np.array([1, 2, 3], dtype=np.float64), attribute_list_bool=[True, False, True], attribute_list_type=np.array([onnx.TensorProto.INT32, @@ -340,15 +340,15 @@ def test_onnx_conversion_extension_attribute_with_default_value(): check_attribute(node, "attribute_str", "abc") check_attribute(node, "attribute_f32", np.float32(5)) check_attribute(node, "attribute_f64", np.float64(5)) - check_attribute(node, "attribute_bool", np.bool(False)) + check_attribute(node, "attribute_bool", False) check_attribute(node, "attribute_type", onnx.TensorProto.FLOAT) check_attribute(node, "attribute_list_i32", np.array([4, 5, 6], dtype=np.int32)) check_attribute(node, "attribute_list_i64", np.array([4, 5, 6], dtype=np.int64)) - check_attribute(node, "attribute_list_str", np.array(["d", "e", "f"], dtype=np.str)) - check_attribute(node, "attribute_list_f32", np.array([4, 5, 6], dtype=np.float)) + check_attribute(node, "attribute_list_str", np.array(["d", "e", "f"], dtype=str)) + check_attribute(node, "attribute_list_f32", np.array([4, 5, 6], dtype=float)) check_attribute(node, "attribute_list_f64", np.array([4, 5, 6], dtype=np.float64)) - check_attribute(node, "attribute_list_bool", np.array([True, False, True], dtype=np.bool)) + check_attribute(node, "attribute_list_bool", np.array([True, False, True], dtype=bool)) check_attribute(node, "attribute_list_type", np.array([onnx.TensorProto.INT32, onnx.TensorProto.FLOAT])) @@ -395,7 +395,7 @@ def test_onnx_conversion_extension_cast_attributes(): check_attribute(node, "attribute_i32", 10, float) check_attribute(node, "attribute_i64", 10, float) - check_attribute(node, "attribute_str", "string", np.str) + check_attribute(node, "attribute_str", "string", str) check_attribute(node, "attribute_f32", 10, int) check_attribute(node, "attribute_f64", 10, int) check_attribute(node, "attribute_bool", True, bool) @@ -403,7 +403,7 @@ def test_onnx_conversion_extension_cast_attributes(): check_attribute(node, "attribute_list_i32", [1., 2., 3.], float) check_attribute(node, "attribute_list_i64", [1., 2., 3.], float) - check_attribute(node, "attribute_list_str", ["a", "b", "c"], np.str) + check_attribute(node, "attribute_list_str", ["a", "b", "c"], str) check_attribute(node, "attribute_list_f32", [1, 2, 3], int) check_attribute(node, "attribute_list_f64", [1, 2, 3], int) check_attribute(node, "attribute_list_bool", [True, False, True], bool) diff --git a/src/bindings/python/tests/test_graph/test_basic.py b/src/bindings/python/tests/test_graph/test_basic.py index fac5131222b..36f25dc9ae4 100644 --- a/src/bindings/python/tests/test_graph/test_basic.py +++ b/src/bindings/python/tests/test_graph/test_basic.py @@ -249,7 +249,7 @@ def test_bad_data_shape(): def test_constant_get_data_bool(): input_data = np.array([True, False, False, True]) - node = ops.constant(input_data, dtype=np.bool) + node = ops.constant(input_data, dtype=bool) retrieved_data = node.get_data() assert np.allclose(input_data, retrieved_data) diff --git a/src/bindings/python/tests/test_graph/test_create_op.py b/src/bindings/python/tests/test_graph/test_create_op.py index 2d0baecb19d..0c079a6f92f 100644 --- a/src/bindings/python/tests/test_graph/test_create_op.py +++ b/src/bindings/python/tests/test_graph/test_create_op.py @@ -792,7 +792,7 @@ def test_rnn_sequence(): def test_loop(): - bool_val = [True] # np.array([1], dtype=np.bool) + bool_val = [True] # np.array([1], dtype=bool) condition = ov.constant(bool_val) trip_count = ov.constant(16, dtype=np.int32) # Body parameters @@ -1816,11 +1816,11 @@ def test_multiclass_nms(): 0.0, -0.1, 1.0, 0.9, 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0], dtype="float32") boxes_data = boxes_data.reshape([1, 6, 4]) - box = ov.constant(boxes_data, dtype=np.float) + box = ov.constant(boxes_data, dtype=float) scores_data = np.array([0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3], dtype="float32") scores_data = scores_data.reshape([1, 2, 6]) - score = ov.constant(scores_data, dtype=np.float) + score = ov.constant(scores_data, dtype=float) nms_node = ov.multiclass_nms(box, score, None, output_type="i32", nms_top_k=3, iou_threshold=0.5, score_threshold=0.0, sort_result_type="classid", @@ -1841,13 +1841,13 @@ def test_multiclass_nms(): [9.66, 3.36, 18.57, 13.26]], [[6.50, 7.00, 13.33, 17.63], [0.73, 5.34, 19.97, 19.97]]]).astype("float32") - box = ov.constant(boxes_data, dtype=np.float) + box = ov.constant(boxes_data, dtype=float) scores_data = np.array([[0.34, 0.66], [0.45, 0.61], [0.39, 0.59]]).astype("float32") - score = ov.constant(scores_data, dtype=np.float) + score = ov.constant(scores_data, dtype=float) rois_num_data = np.array([3]).astype("int32") - roisnum = ov.constant(rois_num_data, dtype=np.int) + roisnum = ov.constant(rois_num_data, dtype=int) nms_node = ov.multiclass_nms(box, score, roisnum, output_type="i32", nms_top_k=3, iou_threshold=0.5, score_threshold=0.0, sort_result_type="classid", nms_eta=1.0) @@ -1867,11 +1867,11 @@ def test_matrix_nms(): 0.0, -0.1, 1.0, 0.9, 0.0, 10.0, 1.0, 11.0, 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0], dtype="float32") boxes_data = boxes_data.reshape([1, 6, 4]) - box = ov.constant(boxes_data, dtype=np.float) + box = ov.constant(boxes_data, dtype=float) scores_data = np.array([0.9, 0.75, 0.6, 0.95, 0.5, 0.3, 0.95, 0.75, 0.6, 0.80, 0.5, 0.3], dtype="float32") scores_data = scores_data.reshape([1, 2, 6]) - score = ov.constant(scores_data, dtype=np.float) + score = ov.constant(scores_data, dtype=float) nms_node = ov.matrix_nms(box, score, output_type="i32", nms_top_k=3, score_threshold=0.0, sort_result_type="score", background_class=0, diff --git a/src/bindings/python/tests/test_graph/test_if.py b/src/bindings/python/tests/test_graph/test_if.py index 2566cd7de95..2db365c15c9 100644 --- a/src/bindings/python/tests/test_graph/test_if.py +++ b/src/bindings/python/tests/test_graph/test_if.py @@ -12,7 +12,7 @@ from openvino.runtime.op.util import InvariantInputDescription, BodyOutputDescri def create_simple_if_with_two_outputs(condition_val): - condition = ov.constant(condition_val, dtype=np.bool) + condition = ov.constant(condition_val, dtype=bool) # then_body x_t = ov.parameter([], np.float32, "X") @@ -54,7 +54,7 @@ def create_simple_if_with_two_outputs(condition_val): def create_diff_if_with_two_outputs(condition_val): - condition = ov.constant(condition_val, dtype=np.bool) + condition = ov.constant(condition_val, dtype=bool) # then_body x_t = ov.parameter([2], np.float32, "X") @@ -90,7 +90,7 @@ def create_diff_if_with_two_outputs(condition_val): def simple_if(condition_val): - condition = ov.constant(condition_val, dtype=np.bool) + condition = ov.constant(condition_val, dtype=bool) # then_body x_t = ov.parameter([2], np.float32, "X") y_t = ov.parameter([2], np.float32, "Y") @@ -121,15 +121,15 @@ def simple_if(condition_val): def simple_if_without_parameters(condition_val): - condition = ov.constant(condition_val, dtype=np.bool) + condition = ov.constant(condition_val, dtype=bool) # then_body - then_constant = ov.constant(0.7, dtype=np.float) + then_constant = ov.constant(0.7, dtype=float) then_body_res_1 = ov.result(then_constant) then_body = Model([then_body_res_1], []) # else_body - else_const = ov.constant(9.0, dtype=np.float) + else_const = ov.constant(9.0, dtype=float) else_body_res_1 = ov.result(else_const) else_body = Model([else_body_res_1], []) @@ -180,7 +180,7 @@ def test_simple_if_without_body_parameters(): def test_simple_if_basic(): - condition = ov.constant(True, dtype=np.bool) + condition = ov.constant(True, dtype=bool) # then_body x_t = ov.parameter([2], np.float32, "X") y_t = ov.parameter([2], np.float32, "Y") diff --git a/src/bindings/python/tests/test_graph/test_loop.py b/src/bindings/python/tests/test_graph/test_loop.py index fdeb954546a..dd035468464 100644 --- a/src/bindings/python/tests/test_graph/test_loop.py +++ b/src/bindings/python/tests/test_graph/test_loop.py @@ -26,11 +26,11 @@ def test_simple_loop(): x_i = ov.parameter(input_shape, np.float32) y_i = ov.parameter(input_shape, np.float32) m_body = ov.parameter(input_shape, np.float32) - bool_val = np.array([1], dtype=np.bool) + bool_val = np.array([1], dtype=bool) bool_val[0] = True body_condition = ov.constant(bool_val) trip_count = ov.constant(10, dtype=np.int64) - exec_condition = ov.constant(True, dtype=np.bool) + exec_condition = ov.constant(True, dtype=bool) add = ov.add(x_i, y_i) zo = ov.multiply(add, m_body) @@ -66,7 +66,7 @@ def test_simple_loop(): def test_loop_basic(): - bool_val = np.array([1], dtype=np.bool) + bool_val = np.array([1], dtype=bool) bool_val[0] = True condition = ov.constant(bool_val) trip_count = ov.constant(16, dtype=np.int32) diff --git a/src/bindings/python/tests/test_graph/test_ops.py b/src/bindings/python/tests/test_graph/test_ops.py index c9eaff88ff7..be0fa20e142 100644 --- a/src/bindings/python/tests/test_graph/test_ops.py +++ b/src/bindings/python/tests/test_graph/test_ops.py @@ -556,7 +556,7 @@ def test_select(): runtime = get_runtime() computation = runtime.computation(function, *parameter_list) result = computation( - np.array([[True, False]], dtype=np.bool), + np.array([[True, False]], dtype=bool), np.array([[5, 6]], dtype=np.float32), np.array([[7, 8]], dtype=np.float32), )[0] diff --git a/src/bindings/python/tests/test_graph/test_ops_binary.py b/src/bindings/python/tests/test_graph/test_ops_binary.py index e092a27c831..67b66a788c5 100644 --- a/src/bindings/python/tests/test_graph/test_ops_binary.py +++ b/src/bindings/python/tests/test_graph/test_ops_binary.py @@ -91,14 +91,14 @@ def test_binary_logical_op(graph_api_helper, numpy_function): runtime = get_runtime() shape = [2, 2] - parameter_a = ov.parameter(shape, name="A", dtype=np.bool) - parameter_b = ov.parameter(shape, name="B", dtype=np.bool) + parameter_a = ov.parameter(shape, name="A", dtype=bool) + parameter_b = ov.parameter(shape, name="B", dtype=bool) model = graph_api_helper(parameter_a, parameter_b) computation = runtime.computation(model, parameter_a, parameter_b) - value_a = np.array([[True, False], [False, True]], dtype=np.bool) - value_b = np.array([[False, True], [False, True]], dtype=np.bool) + value_a = np.array([[True, False], [False, True]], dtype=bool) + value_b = np.array([[False, True], [False, True]], dtype=bool) result = computation(value_a, value_b) expected = numpy_function(value_a, value_b) @@ -112,11 +112,11 @@ def test_binary_logical_op(graph_api_helper, numpy_function): def test_binary_logical_op_with_scalar(graph_api_helper, numpy_function): runtime = get_runtime() - value_a = np.array([[True, False], [False, True]], dtype=np.bool) - value_b = np.array([[False, True], [False, True]], dtype=np.bool) + value_a = np.array([[True, False], [False, True]], dtype=bool) + value_b = np.array([[False, True], [False, True]], dtype=bool) shape = [2, 2] - parameter_a = ov.parameter(shape, name="A", dtype=np.bool) + parameter_a = ov.parameter(shape, name="A", dtype=bool) model = graph_api_helper(parameter_a, value_b) computation = runtime.computation(model, parameter_a) diff --git a/src/bindings/python/tests/test_graph/test_reduction.py b/src/bindings/python/tests/test_graph/test_reduction.py index ae44f97dfde..8adaf02b914 100644 --- a/src/bindings/python/tests/test_graph/test_reduction.py +++ b/src/bindings/python/tests/test_graph/test_reduction.py @@ -53,7 +53,7 @@ def test_reduction_ops(graph_api_helper, numpy_function, reduction_axes): def test_reduction_logical_ops(graph_api_helper, numpy_function, reduction_axes): shape = [2, 4, 3, 2] np.random.seed(133391) - input_data = np.random.randn(*shape).astype(np.bool) + input_data = np.random.randn(*shape).astype(bool) expected = numpy_function(input_data, axis=tuple(reduction_axes)) result = run_op_node([input_data], graph_api_helper, reduction_axes) diff --git a/src/bindings/python/tests/test_graph/test_utils.py b/src/bindings/python/tests/test_graph/test_utils.py index a2ac620ad10..e8d1e483162 100644 --- a/src/bindings/python/tests/test_graph/test_utils.py +++ b/src/bindings/python/tests/test_graph/test_utils.py @@ -8,9 +8,8 @@ from openvino.runtime import Shape def test_get_constant_from_source_success(): - dtype = np.int - input1 = ov.opset8.parameter(Shape([5, 5]), dtype=dtype, name="input_1") - input2 = ov.opset8.parameter(Shape([25]), dtype=dtype, name="input_2") + input1 = ov.opset8.parameter(Shape([5, 5]), dtype=int, name="input_1") + input2 = ov.opset8.parameter(Shape([25]), dtype=int, name="input_2") shape_of = ov.opset8.shape_of(input2, name="shape_of") reshape = ov.opset8.reshape(input1, shape_of, special_zero=True) folded_const = ov.utils.get_constant_from_source(reshape.input(1).get_source_output()) @@ -20,9 +19,8 @@ def test_get_constant_from_source_success(): def test_get_constant_from_source_failed(): - dtype = np.int - input1 = ov.opset8.parameter(Shape([5, 5]), dtype=dtype, name="input_1") - input2 = ov.opset8.parameter(Shape([1]), dtype=dtype, name="input_2") + input1 = ov.opset8.parameter(Shape([5, 5]), dtype=int, name="input_1") + input2 = ov.opset8.parameter(Shape([1]), dtype=int, name="input_2") reshape = ov.opset8.reshape(input1, input2, special_zero=True) folded_const = ov.utils.get_constant_from_source(reshape.input(1).get_source_output()) diff --git a/src/bindings/python/tests/test_onnx/test_ops_logical.py b/src/bindings/python/tests/test_onnx/test_ops_logical.py index a77bc2671b2..a6a284ce500 100644 --- a/src/bindings/python/tests/test_onnx/test_ops_logical.py +++ b/src/bindings/python/tests/test_onnx/test_ops_logical.py @@ -12,9 +12,9 @@ from tests.test_onnx.utils import run_node @pytest.mark.parametrize( ("onnx_op", "numpy_func", "data_type"), [ - pytest.param("And", np.logical_and, np.bool_), - pytest.param("Or", np.logical_or, np.bool_), - pytest.param("Xor", np.logical_xor, np.bool_), + pytest.param("And", np.logical_and, bool), + pytest.param("Or", np.logical_or, bool), + pytest.param("Xor", np.logical_xor, bool), pytest.param("Equal", np.equal, np.int32), pytest.param("Greater", np.greater, np.int32), pytest.param("Less", np.less, np.int32), diff --git a/src/bindings/python/tests/test_onnx/utils/model_importer.py b/src/bindings/python/tests/test_onnx/utils/model_importer.py index fd98a187bfc..2faaaf55e80 100644 --- a/src/bindings/python/tests/test_onnx/utils/model_importer.py +++ b/src/bindings/python/tests/test_onnx/utils/model_importer.py @@ -34,10 +34,6 @@ if getattr(OnnxTestCase, '_fields', None): else: # for ONNX >= 1.12 ExtOnnxTestCase = tuple((field.name for field in dataclasses.fields(OnnxTestCase))) + ("post_processing",) -#ExtOnnxTestCase = namedtuple("TestCaseExt", OnnxTestCase_fields + ("post_processing",)) -#ExtOnnxTestCase = namedtuple("TestCaseExt", OnnxTestCase_fields + ("post_processing",)) - - class ModelImportRunner(onnx.backend.test.BackendTest): def __init__( self, diff --git a/src/bindings/python/tests/test_runtime/test_infer_request.py b/src/bindings/python/tests/test_runtime/test_infer_request.py index bfa44c1353d..24f854d40a7 100644 --- a/src/bindings/python/tests/test_runtime/test_infer_request.py +++ b/src/bindings/python/tests/test_runtime/test_infer_request.py @@ -376,7 +376,7 @@ def test_infer_mixed_keys(device): (Type.u16, np.uint16), (Type.i64, np.int64), (Type.u64, np.uint64), - (Type.boolean, np.bool_), + (Type.boolean, bool), ]) def test_infer_mixed_values(device, ov_type, numpy_dtype): request, tensor1, array1 = concat_model_with_data(device, ov_type, numpy_dtype) @@ -399,7 +399,7 @@ def test_infer_mixed_values(device, ov_type, numpy_dtype): (Type.u16, np.uint16), (Type.i64, np.int64), (Type.u64, np.uint64), - (Type.boolean, np.bool_), + (Type.boolean, bool), ]) def test_async_mixed_values(device, ov_type, numpy_dtype): request, tensor1, array1 = concat_model_with_data(device, ov_type, numpy_dtype) diff --git a/src/bindings/python/tests/test_runtime/test_tensor.py b/src/bindings/python/tests/test_runtime/test_tensor.py index 12625489d36..b17a2b89359 100644 --- a/src/bindings/python/tests/test_runtime/test_tensor.py +++ b/src/bindings/python/tests/test_runtime/test_tensor.py @@ -30,7 +30,7 @@ from ..test_utils.test_utils import generate_image # TODO: reformat into an abs (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), (ov.Type.u1, np.uint8), (ov.Type.u4, np.uint8), (ov.Type.i4, np.int8), @@ -64,7 +64,7 @@ def test_subprocess(): (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), ]) def test_init_with_numpy_dtype(ov_type, numpy_dtype): shape = (1, 3, 127, 127) @@ -94,7 +94,7 @@ def test_init_with_numpy_dtype(ov_type, numpy_dtype): (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), ]) def test_init_with_numpy_shared_memory(ov_type, numpy_dtype): arr = generate_image().astype(numpy_dtype) @@ -131,7 +131,7 @@ def test_init_with_numpy_shared_memory(ov_type, numpy_dtype): (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), ]) def test_init_with_numpy_copy_memory(ov_type, numpy_dtype): arr = generate_image().astype(numpy_dtype) @@ -178,7 +178,7 @@ def test_init_with_roi_tensor(): (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), ]) def test_write_to_buffer(ov_type, numpy_dtype): ov_tensor = Tensor(ov_type, ov.Shape([1, 3, 32, 32])) @@ -200,7 +200,7 @@ def test_write_to_buffer(ov_type, numpy_dtype): (ov.Type.u16, np.uint16), (ov.Type.i64, np.int64), (ov.Type.u64, np.uint64), - (ov.Type.boolean, np.bool_), + (ov.Type.boolean, bool), ]) def test_set_shape(ov_type, numpy_dtype): shape = ov.Shape([1, 3, 32, 32]) diff --git a/src/bindings/python/tests/test_runtime/test_type.py b/src/bindings/python/tests/test_runtime/test_type.py index 5e0a881c440..0e0e99068b6 100644 --- a/src/bindings/python/tests/test_runtime/test_type.py +++ b/src/bindings/python/tests/test_runtime/test_type.py @@ -20,7 +20,7 @@ from openvino.runtime import Type ("uint16", np.uint16, Type.u16), ("uint32", np.uint32, Type.u32), ("uint64", np.uint64, Type.u64), - ("bool", np.bool_, Type.boolean), + ("bool", bool, Type.boolean), ]) def test_dtype_ovtype_conversion(dtype_string, dtype, ovtype): assert ovtype.to_dtype() == dtype diff --git a/src/bindings/python/tests/test_transformations/test_pattern_ops.py b/src/bindings/python/tests/test_transformations/test_pattern_ops.py index 702bc5dae2b..817f6f4c21d 100644 --- a/src/bindings/python/tests/test_transformations/test_pattern_ops.py +++ b/src/bindings/python/tests/test_transformations/test_pattern_ops.py @@ -85,7 +85,7 @@ def test_any_input_predicate(): def test_all_predicates(): static_param = opset8.parameter(PartialShape([1, 3, 22, 22]), np.float32) - dynamic_param = opset8.parameter(PartialShape([-1, 6]), np.long) + dynamic_param = opset8.parameter(PartialShape([-1, 6]), np.compat.long) fully_dynamic_param = opset8.parameter(PartialShape.dynamic()) assert Matcher(WrapType("opset8.Parameter", consumers_count(0)), "Test").match(static_param) @@ -110,7 +110,7 @@ def test_all_predicates(): assert Matcher(WrapType("opset8.Parameter", type_matches_any([get_element_type(np.float32), - get_element_type(np.long)])), "Test").match(static_param) + get_element_type(np.compat.long)])), "Test").match(static_param) assert Matcher(WrapType("opset8.Parameter", type_matches_any([get_element_type(np.float32), - get_element_type(np.long)])), "Test").match(dynamic_param) + get_element_type(np.compat.long)])), "Test").match(dynamic_param)