OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Update clone_with_new_inputs (#26071)
Eddy Kim7e19d9b6bb59
diff --git a/src/common/transformations/include/ov_ops/type_relaxed.hpp b/src/common/transformations/include/ov_ops/type_relaxed.hppindex 77b0ca774c3..ddc0118882e 100644--- a/src/common/transformations/include/ov_ops/type_relaxed.hpp+++ b/src/common/transformations/include/ov_ops/type_relaxed.hpp@@ -300,8 +300,7 @@ std::shared_ptr<Node> TypeRelaxed<BaseOp>::clone_with_new_inputs(const OutputVecauto origin_input_type = get_origin_input_type(i);if (origin_input_type == element::undefined)origin_input_type = BaseOp::get_input_element_type(i);- fake_new_inputs.push_back(- std::make_shared<v0::Parameter>(origin_input_type, BaseOp::get_input_partial_shape(i)));+ fake_new_inputs.push_back(std::make_shared<v0::Parameter>(origin_input_type, new_args[i].get_partial_shape()));}auto base_op = BaseOp::clone_with_new_inputs(fake_new_inputs);// since originally TypeRelaxed was copying everything from the original node, we continue doing the samediff --git a/src/common/transformations/tests/common_optimizations/move_eltwise_up_data_movement_test.cpp b/src/common/transformations/tests/common_optimizations/move_eltwise_up_data_movement_test.cppindex cba3ae82d90..374cd208fef 100644--- a/src/common/transformations/tests/common_optimizations/move_eltwise_up_data_movement_test.cpp+++ b/src/common/transformations/tests/common_optimizations/move_eltwise_up_data_movement_test.cpp@@ -445,3 +445,33 @@ TEST_F(MoveEltwiseUpThroughDataMovTest, PerChannelEltwiseSqueezeIllegal_1) {model = std::make_shared<ov::Model>(ov::NodeVector{add}, ov::ParameterVector{input});manager.register_pass<ov::pass::MoveEltwiseUpThroughDataMov>();}++TEST_F(MoveEltwiseUpThroughDataMovTest, PerChannelReshapeMultiply) {+ const ov::Shape shape{1, 3, 20};+ const std::vector<int64_t> target_shape = {1, 3, 4, 5};+ {+ auto input = std::make_shared<ov::opset8::Parameter>(ov::element::f32, shape);++ auto reshape_constant =+ std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{target_shape.size()}, target_shape);+ auto reshape = std::make_shared<ov::op::v1::Reshape>(input, reshape_constant, false);++ auto per_channel_const = ov::opset8::Constant::create(ov::element::f32, {1, 3, 1, 1}, {0.5});+ auto multiply = std::make_shared<ov::op::v1::Multiply>(reshape, per_channel_const);++ model = std::make_shared<ov::Model>(ov::NodeVector{multiply}, ov::ParameterVector{input});+ manager.register_pass<ov::pass::MoveEltwiseUpThroughDataMov>();+ }+ {+ auto input = std::make_shared<ov::opset8::Parameter>(ov::element::f32, shape);++ auto per_channel_const = ov::opset8::Constant::create(ov::element::f32, {1, 3, 1}, {0.5});+ auto multiply = std::make_shared<ov::op::v1::Multiply>(input, per_channel_const);++ auto reshape_constant =+ std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{target_shape.size()}, target_shape);+ auto reshape = std::make_shared<ov::op::v1::Reshape>(multiply, reshape_constant, false);++ model_ref = std::make_shared<ov::Model>(ov::NodeVector{reshape}, ov::ParameterVector{input});+ }+}