Skip to content

Commit

Permalink
fix throwing exception for bool type (openvinotoolkit#8172)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkozykowski authored Nov 5, 2021
1 parent 5f7e3cd commit 9731d9a
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 56 deletions.
2 changes: 2 additions & 0 deletions runtime/bindings/python/src/pyopenvino/core/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ void blob_from_numpy(const py::handle& arr, InferenceEngine::Blob::Ptr blob) {
Common::fill_blob<float>(arr, blob);
} else if (py::isinstance<py::array_t<double>>(arr)) {
Common::fill_blob<double>(arr, blob);
} else if (py::isinstance<py::array_t<bool>>(arr)) {
Common::fill_blob<bool>(arr, blob);
} else if (py::isinstance<py::array_t<int8_t>>(arr)) {
Common::fill_blob<int8_t>(arr, blob);
} else if (py::isinstance<py::array_t<int16_t>>(arr)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
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(
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions runtime/bindings/python/tests/test_ngraph/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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


Expand Down Expand Up @@ -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]))
Expand Down
4 changes: 0 additions & 4 deletions runtime/bindings/python/tests/test_ngraph/test_ops_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
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",
Expand Down Expand Up @@ -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)],
Expand All @@ -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)],
Expand Down
3 changes: 0 additions & 3 deletions runtime/bindings/python/tests/test_ngraph/test_ops_unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
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",
Expand Down Expand Up @@ -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]))]
)
Expand Down
3 changes: 0 additions & 3 deletions runtime/bindings/python/tests/test_ngraph/test_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
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",
Expand Down Expand Up @@ -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",
[
Expand Down
35 changes: 0 additions & 35 deletions runtime/bindings/python/tests/test_onnx/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,48 +108,13 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
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,
Expand Down
9 changes: 3 additions & 6 deletions runtime/bindings/python/tests/test_onnx/test_ops_logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

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),
Expand All @@ -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)
Expand Down

0 comments on commit 9731d9a

Please sign in to comment.