Skip to content

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

[ONNX FE] Remove explicit broadcasting for eltwise ops (#32191)

Maxim Vafinadd3f1655663
diff --git a/src/frontends/onnx/frontend/src/utils/common.cpp b/src/frontends/onnx/frontend/src/utils/common.cpp
index 2ee46643415..4b3038905cf 100644
--- a/src/frontends/onnx/frontend/src/utils/common.cpp
+++ b/src/frontends/onnx/frontend/src/utils/common.cpp
@@ -171,7 +171,8 @@ ov::OutputVector handle_opset6_binary_op(const ov::frontend::onnx::Node& node) {
auto new_shape = std::make_shared<v0::Concat>(ov::OutputVector{rhs_shape, ones}, 0);
rhs_node = std::make_shared<v1::Reshape>(rhs_node, new_shape, false);
}
- } else {
+ } else if (!std::is_base_of<op::util::BinaryElementwiseArithmetic, T>::value) {
+ // Broadcasting is done automatically in BinaryElementwiseArithmetic ops
rhs_node = std::make_shared<v3::Broadcast>(rhs_node, std::make_shared<v0::ShapeOf>(lhs_node));
}
}