Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[PyOV] Fix custom op test which hangs on win (#30128)

Anastasia Kuporosova07b698011a43
diff --git a/src/bindings/python/tests/test_graph/test_custom_op.py b/src/bindings/python/tests/test_graph/test_custom_op.py
index fb941a65c34..4f8f36ae4c1 100644
--- a/src/bindings/python/tests/test_graph/test_custom_op.py
+++ b/src/bindings/python/tests/test_graph/test_custom_op.py
@@ -98,7 +98,7 @@ class CustomOpWithAttribute(Op):
self.set_output_type(0, self.get_input_element_type(0), self.get_input_partial_shape(0))
def clone_with_new_inputs(self, new_inputs):
- return CustomOpWithAttribute(new_inputs)
+ return CustomOpWithAttribute(new_inputs, self._attrs)
def get_type_info(self):
return CustomOpWithAttribute.class_type_info
@@ -138,8 +138,7 @@ def prepared_paths(request, tmp_path):
({"wrong_np": np.array([1.5, 2.5], dtype="complex128")}, pytest.raises(TypeError), "Unsupported NumPy array dtype: complex128"),
({"wrong": {}}, pytest.raises(TypeError), "Unsupported attribute type: <class 'dict'>")
])
[email protected](sys.platform == "win32", reason="CVS-164354 BUG: hanged on windows wheels")
-def test_visit_attributes_custom_op(prepared_paths, attributes, expectation, raise_msg):
+def test_visit_attributes_custom_op(device, prepared_paths, attributes, expectation, raise_msg):
input_shape = [2, 1]
param1 = ops.parameter(Shape(input_shape), dtype=np.float32, name="data1")
@@ -165,7 +164,7 @@ def test_visit_attributes_custom_op(prepared_paths, attributes, expectation, rai
input_data = np.ones([2, 1], dtype=np.float32)
expected_output = np.maximum(0.0, input_data)
- compiled_model = compile_model(model_with_op_attr)
+ compiled_model = compile_model(model_with_op_attr, device)
input_tensor = Tensor(input_data)
results = compiled_model({"data1": input_tensor})
assert np.allclose(results[list(results)[0]], expected_output, 1e-4, 1e-4)
@@ -200,9 +199,9 @@ def test_custom_add_model():
assert op_types == ["Parameter", "Parameter", "CustomAdd", "Result"]
-def test_custom_op():
+def test_custom_op(device):
model = create_snake_model()
- compiled_model = compile_model(model)
+ compiled_model = compile_model(model, device)
assert isinstance(compiled_model, CompiledModel)
request = compiled_model.create_infer_request()