diff --git a/src/bindings/python/tests_compatibility/test_onnx/test_backend.py b/src/bindings/python/tests_compatibility/test_onnx/test_backend.py index c1f9a4d7b774bf..0034c66ca821ad 100644 --- a/src/bindings/python/tests_compatibility/test_onnx/test_backend.py +++ b/src/bindings/python/tests_compatibility/test_onnx/test_backend.py @@ -524,20 +524,17 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None ), ( skip_bitwise_ui64, - "OnnxBackendNodeModelTest.test_bitwise_and_ui64_bcast_3v1d_cpu", + "OnnxBackendNodeModelTest.test_bitwise_and_ui64_bcast_3v1d_cpu", + "OnnxBackendNodeModelTest.test_bitwise_or_ui64_bcast_3v1d_cpu", ), ( xfail_issue_99949, "OnnxBackendNodeModelTest.test_bitwise_not_2d_cpu", "OnnxBackendNodeModelTest.test_bitwise_not_3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_not_4d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_i16_4d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_i32_2d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_ui64_bcast_3v1d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_ui8_bcast_4v3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_i16_3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_i32_2d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_ui8_bcast_4v3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_ui64_bcast_3v1d_cpu", ), ( diff --git a/src/frontends/onnx/frontend/src/op/bitwise_or.cpp b/src/frontends/onnx/frontend/src/op/bitwise_or.cpp new file mode 100644 index 00000000000000..38d9f04a48b0fa --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/bitwise_or.cpp @@ -0,0 +1,24 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "op/bitwise_or.hpp" +OPENVINO_SUPPRESS_DEPRECATED_START + +#include "default_opset.hpp" + +using namespace ov::op; + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_1 { +OutputVector bitwise_or(const Node& node) { + const auto inputs = node.get_ng_inputs(); + OPENVINO_ASSERT(inputs.size() == 2); + return {std::make_shared(inputs[0], inputs[1])}; +} +} // namespace set_1 +} // namespace op +} // namespace onnx_import +} // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/bitwise_or.hpp b/src/frontends/onnx/frontend/src/op/bitwise_or.hpp new file mode 100644 index 00000000000000..8bb00623c48a0c --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/bitwise_or.hpp @@ -0,0 +1,25 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "openvino/core/deprecated.hpp" +OPENVINO_SUPPRESS_DEPRECATED_START + +#include "ngraph/node.hpp" +#include "onnx_import/core/node.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_1 { +OutputVector bitwise_or(const Node& node); + +} // namespace set_1 +} // namespace op + +} // namespace onnx_import + +} // namespace ngraph +OPENVINO_SUPPRESS_DEPRECATED_END diff --git a/src/frontends/onnx/frontend/src/ops_bridge.cpp b/src/frontends/onnx/frontend/src/ops_bridge.cpp index fefe1879e40988..8af180648ca634 100644 --- a/src/frontends/onnx/frontend/src/ops_bridge.cpp +++ b/src/frontends/onnx/frontend/src/ops_bridge.cpp @@ -30,6 +30,7 @@ #include "op/batch_norm.hpp" #include "op/bitshift.hpp" #include "op/bitwise_and.hpp" +#include "op/bitwise_or.hpp" #include "op/blackmanwindow.hpp" #include "op/cast.hpp" #include "op/cast_like.hpp" @@ -353,6 +354,7 @@ OperatorsBridge::OperatorsBridge() { REGISTER_OPERATOR("BatchNormalization", 7, batch_norm); REGISTER_OPERATOR("BitShift", 1, bitshift); REGISTER_OPERATOR("BitwiseAnd", 1, bitwise_and); + REGISTER_OPERATOR("BitwiseOr", 1, bitwise_or); REGISTER_OPERATOR("BlackmanWindow", 1, blackmanwindow); REGISTER_OPERATOR("Cast", 1, cast); REGISTER_OPERATOR("CastLike", 1, cast_like); diff --git a/src/frontends/onnx/tests/models/bitwise_or.prototxt b/src/frontends/onnx/tests/models/bitwise_or.prototxt new file mode 100644 index 00000000000000..28765b01e2b5b9 --- /dev/null +++ b/src/frontends/onnx/tests/models/bitwise_or.prototxt @@ -0,0 +1,53 @@ +ir_version: 7 +graph { + node { + input: "a" + input: "b" + output: "output" + op_type: "BitwiseOr" + } + name: "BitwiseOrGraph" + input { + name: "a" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 5 + } + } + } + } + } + input { + name: "b" + type { + tensor_type { + elem_type:6 + shape { + dim { + dim_value: 5 + } + } + } + } + } + output { + name: "output" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 5 + } + } + } + } + } +} +opset_import { + domain: "" + version: 16 +} \ No newline at end of file diff --git a/src/frontends/onnx/tests/models/bitwise_or_broadcast_condition.prototxt b/src/frontends/onnx/tests/models/bitwise_or_broadcast_condition.prototxt new file mode 100644 index 00000000000000..0a818ca991e735 --- /dev/null +++ b/src/frontends/onnx/tests/models/bitwise_or_broadcast_condition.prototxt @@ -0,0 +1,53 @@ +ir_version: 7 +graph { + node { + input: "a" + input: "b" + output: "output" + op_type: "BitwiseOr" + } + name: "BitwiseOrGraph" + input { + name: "a" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 5 + } + } + } + } + } + input { + name: "b" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 1 + } + } + } + } + } + output { + name: "output" + type { + tensor_type { + elem_type: 6 + shape { + dim { + dim_value: 5 + } + } + } + } + } +} +opset_import { + domain: "" + version: 16 +} \ No newline at end of file diff --git a/src/frontends/onnx/tests/onnx_import.in.cpp b/src/frontends/onnx/tests/onnx_import.in.cpp index 8e547236163159..57ef1e9b208e33 100644 --- a/src/frontends/onnx/tests/onnx_import.in.cpp +++ b/src/frontends/onnx/tests/onnx_import.in.cpp @@ -6139,3 +6139,25 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_bitwise_and_broadcast_condition) { test_case.run(); } + +OPENVINO_TEST(${BACKEND_NAME}, onnx_model_bitwise_or) { + auto model = convert_model("bitwise_or.onnx"); + + auto test_case = ov::test::TestCase(model, s_device); + test_case.add_input(Shape{5}, {1, 2, 3, 4, 5}); + test_case.add_input(Shape{5}, {5, 5, 5, 5, 5}); + test_case.add_expected_output(Shape{5}, {5, 7, 7, 5, 5}); + + test_case.run(); +} + +OPENVINO_TEST(${BACKEND_NAME}, onnx_model_bitwise_or_broadcast_condition) { + auto model = convert_model("bitwise_or_broadcast_condition.onnx"); + + auto test_case = ov::test::TestCase(model, s_device); + test_case.add_input(Shape{5}, {1, 2, 3, 4, 5}); + test_case.add_input(Shape{1}, {4}); + test_case.add_expected_output(Shape{5}, {5, 6, 7, 4, 5}); + + test_case.run(); +} diff --git a/src/frontends/onnx/tests/tests_python/test_backend.py b/src/frontends/onnx/tests/tests_python/test_backend.py index bf9af6c6532139..d75458cd47f9ad 100644 --- a/src/frontends/onnx/tests/tests_python/test_backend.py +++ b/src/frontends/onnx/tests/tests_python/test_backend.py @@ -393,19 +393,16 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None ( skip_bitwise_ui64, "OnnxBackendNodeModelTest.test_bitwise_and_ui64_bcast_3v1d_cpu", + "OnnxBackendNodeModelTest.test_bitwise_or_ui64_bcast_3v1d_cpu", ), ( xfail_issue_99949, "OnnxBackendNodeModelTest.test_bitwise_not_2d_cpu", "OnnxBackendNodeModelTest.test_bitwise_not_3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_not_4d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_i16_4d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_i32_2d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_ui64_bcast_3v1d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_ui8_bcast_4v3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_i16_3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_i32_2d_cpu", - "OnnxBackendNodeModelTest.test_bitwise_or_ui8_bcast_4v3d_cpu", "OnnxBackendNodeModelTest.test_bitwise_xor_ui64_bcast_3v1d_cpu", ), (