From 9731d9a295416e66e3790b72ba78b1c0e05d6c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ko=C5=BCykowski?= Date: Fri, 5 Nov 2021 14:15:28 +0100 Subject: [PATCH] fix throwing exception for bool type (#8172) --- .../python/src/pyopenvino/core/common.cpp | 2 ++ .../tests/test_ngraph/test_data_movement.py | 3 -- .../python/tests/test_ngraph/test_ops.py | 2 -- .../tests/test_ngraph/test_ops_binary.py | 4 --- .../tests/test_ngraph/test_ops_unary.py | 3 -- .../tests/test_ngraph/test_reduction.py | 3 -- .../python/tests/test_onnx/test_backend.py | 35 ------------------- .../tests/test_onnx/test_ops_logical.py | 9 ++--- 8 files changed, 5 insertions(+), 56 deletions(-) diff --git a/runtime/bindings/python/src/pyopenvino/core/common.cpp b/runtime/bindings/python/src/pyopenvino/core/common.cpp index 098a85f2ffc..741ec010971 100644 --- a/runtime/bindings/python/src/pyopenvino/core/common.cpp +++ b/runtime/bindings/python/src/pyopenvino/core/common.cpp @@ -243,6 +243,8 @@ void blob_from_numpy(const py::handle& arr, InferenceEngine::Blob::Ptr blob) { Common::fill_blob(arr, blob); } else if (py::isinstance>(arr)) { Common::fill_blob(arr, blob); + } else if (py::isinstance>(arr)) { + Common::fill_blob(arr, blob); } else if (py::isinstance>(arr)) { Common::fill_blob(arr, blob); } else if (py::isinstance>(arr)) { diff --git a/runtime/bindings/python/tests/test_ngraph/test_data_movement.py b/runtime/bindings/python/tests/test_ngraph/test_data_movement.py index 0baac90c011..624427210a8 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_data_movement.py +++ b/runtime/bindings/python/tests/test_ngraph/test_data_movement.py @@ -8,8 +8,6 @@ from openvino.impl import Type, Shape from tests.runtime import get_runtime from tests.test_ngraph.util import run_op_node -from tests import xfail_issue_67415 - def test_reverse_sequence(): input_data = np.array( @@ -180,7 +178,6 @@ def test_pad_constant(): assert np.allclose(result, expected) -@xfail_issue_67415 def test_select(): cond = np.array([[False, False], [True, False], [True, True]]) then_node = np.array([[-1, 0], [1, 2], [3, 4]], dtype=np.int32) diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops.py b/runtime/bindings/python/tests/test_ngraph/test_ops.py index 4e4ce9005cf..4719466c451 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_ops.py +++ b/runtime/bindings/python/tests/test_ngraph/test_ops.py @@ -10,7 +10,6 @@ from openvino.impl import AxisSet, Function, Shape, Type from openvino.impl.op import Constant, Parameter from tests.runtime import get_runtime -from tests import xfail_issue_67415 from tests import xfail_issue_54663 @@ -523,7 +522,6 @@ def test_axisset(): assert set(tuple_axisset) == set(set_axisset) -@xfail_issue_67415 def test_select(): element_type = Type.f32 A = Parameter(Type.boolean, Shape([1, 2])) diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_binary.py b/runtime/bindings/python/tests/test_ngraph/test_ops_binary.py index 7a910eae3c5..8e965c9e3f0 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_ops_binary.py +++ b/runtime/bindings/python/tests/test_ngraph/test_ops_binary.py @@ -10,8 +10,6 @@ import openvino.opset8 as ov from tests.runtime import get_runtime from tests.test_ngraph.util import run_op_node -from tests import xfail_issue_67415 - @pytest.mark.parametrize( "ng_api_helper,numpy_function", @@ -84,7 +82,6 @@ def test_binary_op_with_scalar(ng_api_helper, numpy_function): assert np.allclose(result, expected) -@xfail_issue_67415 @pytest.mark.parametrize( "ng_api_helper,numpy_function", [(ov.logical_and, np.logical_and), (ov.logical_or, np.logical_or), (ov.logical_xor, np.logical_xor)], @@ -107,7 +104,6 @@ def test_binary_logical_op(ng_api_helper, numpy_function): assert np.allclose(result, expected) -@xfail_issue_67415 @pytest.mark.parametrize( "ng_api_helper,numpy_function", [(ov.logical_and, np.logical_and), (ov.logical_or, np.logical_or), (ov.logical_xor, np.logical_xor)], diff --git a/runtime/bindings/python/tests/test_ngraph/test_ops_unary.py b/runtime/bindings/python/tests/test_ngraph/test_ops_unary.py index e3049141802..7ce4f98e945 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_ops_unary.py +++ b/runtime/bindings/python/tests/test_ngraph/test_ops_unary.py @@ -9,8 +9,6 @@ from openvino.impl import Shape, Type from tests.runtime import get_runtime from tests.test_ngraph.util import run_op_node -from tests import xfail_issue_67415 - @pytest.mark.parametrize( "ng_api_fn, numpy_fn, range_start, range_end", @@ -79,7 +77,6 @@ def test_unary_op_scalar(ng_api_fn, numpy_fn, input_data): assert np.allclose(result, expected) -@xfail_issue_67415 @pytest.mark.parametrize( "input_data", [(np.array([True, False, True, False])), (np.array([True])), (np.array([False]))] ) diff --git a/runtime/bindings/python/tests/test_ngraph/test_reduction.py b/runtime/bindings/python/tests/test_ngraph/test_reduction.py index 12334fbe82f..8ac606eaa85 100644 --- a/runtime/bindings/python/tests/test_ngraph/test_reduction.py +++ b/runtime/bindings/python/tests/test_ngraph/test_reduction.py @@ -10,8 +10,6 @@ from openvino.utils.types import make_constant_node from tests.runtime import get_runtime from tests.test_ngraph.util import run_op_node -from tests import xfail_issue_67415 - @pytest.mark.parametrize( "ng_api_helper, numpy_function, reduction_axes", @@ -40,7 +38,6 @@ def test_reduction_ops(ng_api_helper, numpy_function, reduction_axes): assert np.allclose(result, expected) -@xfail_issue_67415 @pytest.mark.parametrize( "ng_api_helper, numpy_function, reduction_axes", [ diff --git a/runtime/bindings/python/tests/test_onnx/test_backend.py b/runtime/bindings/python/tests/test_onnx/test_backend.py index 16f432e101d..dc7acd38d6f 100644 --- a/runtime/bindings/python/tests/test_onnx/test_backend.py +++ b/runtime/bindings/python/tests/test_onnx/test_backend.py @@ -108,48 +108,13 @@ globals().update(backend_test.enable_report().test_cases) tests_expected_to_fail = [ ( xfail_issue_67415, - "OnnxBackendNodeModelTest.test_and2d_cpu", - "OnnxBackendNodeModelTest.test_and3d_cpu", - "OnnxBackendNodeModelTest.test_and4d_cpu", - "OnnxBackendNodeModelTest.test_and_bcast3v1d_cpu", - "OnnxBackendNodeModelTest.test_and_bcast3v2d_cpu", - "OnnxBackendNodeModelTest.test_and_bcast4v2d_cpu", - "OnnxBackendNodeModelTest.test_and_bcast4v3d_cpu", - "OnnxBackendNodeModelTest.test_and_bcast4v4d_cpu", "OnnxBackendNodeModelTest.test_cast_FLOAT16_to_DOUBLE_cpu", "OnnxBackendNodeModelTest.test_cast_FLOAT16_to_FLOAT_cpu", "OnnxBackendNodeModelTest.test_castlike_FLOAT16_to_DOUBLE_expanded_cpu", "OnnxBackendNodeModelTest.test_castlike_FLOAT16_to_FLOAT_expanded_cpu", - "OnnxBackendNodeModelTest.test_if_cpu", "OnnxBackendNodeModelTest.test_max_float16_cpu", "OnnxBackendNodeModelTest.test_min_float16_cpu", "OnnxBackendNodeModelTest.test_mod_mixed_sign_float16_cpu", - "OnnxBackendNodeModelTest.test_not_2d_cpu", - "OnnxBackendNodeModelTest.test_not_3d_cpu", - "OnnxBackendNodeModelTest.test_not_4d_cpu", - "OnnxBackendNodeModelTest.test_or2d_cpu", - "OnnxBackendNodeModelTest.test_or3d_cpu", - "OnnxBackendNodeModelTest.test_or4d_cpu", - "OnnxBackendNodeModelTest.test_or_bcast3v1d_cpu", - "OnnxBackendNodeModelTest.test_or_bcast3v2d_cpu", - "OnnxBackendNodeModelTest.test_or_bcast4v2d_cpu", - "OnnxBackendNodeModelTest.test_or_bcast4v3d_cpu", - "OnnxBackendNodeModelTest.test_or_bcast4v4d_cpu", - "OnnxBackendNodeModelTest.test_where_example_cpu", - "OnnxBackendNodeModelTest.test_where_long_example_cpu", - "OnnxBackendNodeModelTest.test_xor2d_cpu", - "OnnxBackendNodeModelTest.test_xor3d_cpu", - "OnnxBackendNodeModelTest.test_xor4d_cpu", - "OnnxBackendNodeModelTest.test_xor_bcast3v1d_cpu", - "OnnxBackendNodeModelTest.test_xor_bcast3v2d_cpu", - "OnnxBackendNodeModelTest.test_xor_bcast4v2d_cpu", - "OnnxBackendNodeModelTest.test_xor_bcast4v3d_cpu", - "OnnxBackendNodeModelTest.test_xor_bcast4v4d_cpu", - "OnnxBackendNodeModelTest.test_compress_0_cpu", - "OnnxBackendNodeModelTest.test_compress_1_cpu", - "OnnxBackendNodeModelTest.test_compress_default_axis_cpu", - "OnnxBackendNodeModelTest.test_compress_negative_axis_cpu", - "OnnxBackendNodeModelTest.test_nonzero_example_cpu", ), ( xfail_issue_49207, diff --git a/runtime/bindings/python/tests/test_onnx/test_ops_logical.py b/runtime/bindings/python/tests/test_onnx/test_ops_logical.py index aabd4304277..150d5067358 100644 --- a/runtime/bindings/python/tests/test_onnx/test_ops_logical.py +++ b/runtime/bindings/python/tests/test_onnx/test_ops_logical.py @@ -7,15 +7,13 @@ import pytest from tests.test_onnx.utils import run_node -from tests import xfail_issue_67415 - @pytest.mark.parametrize( "onnx_op, numpy_func, data_type", [ - pytest.param("And", np.logical_and, np.bool, marks=xfail_issue_67415), - pytest.param("Or", np.logical_or, np.bool, marks=xfail_issue_67415), - pytest.param("Xor", np.logical_xor, np.bool, marks=xfail_issue_67415), + 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("Equal", np.equal, np.int32), pytest.param("Greater", np.greater, np.int32), pytest.param("Less", np.less, np.int32), @@ -37,7 +35,6 @@ def test_logical(onnx_op, numpy_func, data_type): assert np.array_equal(ng_results, [expected_output]) -@xfail_issue_67415 def test_logical_not(): input_data = np.array([[False, True, True], [False, True, False], [False, False, True]]) expected_output = np.logical_not(input_data)