[CPU] friendly name duplication fixed for the TypeRelaxed case (#10486)
This commit is contained in:
parent
b9ef57112e
commit
1ceb9729e9
@ -95,6 +95,9 @@ ov::intel_cpu::MoveEltwiseUpThroughDataMov::MoveEltwiseUpThroughDataMov() {
|
||||
ngraph::OutputVector eltwiseInputs = eltwise->input_values();
|
||||
eltwiseInputs[0] = child->input_value(0);
|
||||
auto newEltwise = eltwise->clone_with_new_inputs(eltwiseInputs);
|
||||
// WA: it's necessary to set empty friendly name here
|
||||
// to avoid name duplication in TypeRelaxed cases
|
||||
newEltwise->set_friendly_name("");
|
||||
ngraph::copy_runtime_info(eltwise, newEltwise);
|
||||
|
||||
ngraph::OutputVector childInputs = child->input_values();
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <ngraph/function.hpp>
|
||||
#include <ngraph/opsets/opset8.hpp>
|
||||
#include "ngraph_ops/type_relaxed.hpp"
|
||||
#include <transformations/init_node_info.hpp>
|
||||
#include <ngraph/pass/manager.hpp>
|
||||
|
||||
@ -49,6 +50,38 @@ TEST_F(MoveEltwiseUpThroughDataMovTest, SingleUnaryEltwise) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MoveEltwiseUpThroughDataMovTest, TypeRelaxedEltwise) {
|
||||
const ngraph::Shape shape{1, 3, 224, 224};
|
||||
const std::vector<int64_t> input_order = {3, 2, 1, 0};
|
||||
{
|
||||
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::f32, shape);
|
||||
auto intermediate_op = std::make_shared<ngraph::opset8::Clamp>(input, 0, 6);
|
||||
|
||||
auto transpose_const =
|
||||
ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape{input_order.size()}, input_order);
|
||||
auto transpose = std::make_shared<ngraph::opset8::Transpose>(intermediate_op, transpose_const);
|
||||
|
||||
auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f32, {}, {2.f});
|
||||
auto multiply = std::make_shared<ngraph::op::TypeRelaxed<ngraph::opset8::Multiply>>(transpose, mul_const);
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{multiply}, ngraph::ParameterVector{input});
|
||||
manager.register_pass<ov::intel_cpu::MoveEltwiseUpThroughDataMov>();
|
||||
}
|
||||
{
|
||||
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::f32, shape);
|
||||
auto intermediate_op = std::make_shared<ngraph::opset8::Clamp>(input, 0, 6);
|
||||
|
||||
auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f32, {}, {2.f});
|
||||
auto multiply = std::make_shared<ngraph::op::TypeRelaxed<ngraph::opset8::Multiply>>(intermediate_op, mul_const);
|
||||
|
||||
auto transpose_const = ngraph::opset8::Constant::create(ngraph::element::i64, ngraph::Shape{input_order.size()}, input_order);
|
||||
auto transpose = std::make_shared<ngraph::opset8::Transpose>(multiply, transpose_const);
|
||||
|
||||
function_ref =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{transpose}, ngraph::ParameterVector{input});
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MoveEltwiseUpThroughDataMovTest, EltwiseSequence) {
|
||||
const ngraph::Shape shape{1, 3, 224, 224};
|
||||
const std::vector<int64_t> input_order = {1, 2, 0, 3};
|
||||
|
Loading…
Reference in New Issue
Block a user