Create reshape with scalar when shape is empty

This commit is contained in:
Artur Kulikowski 2022-12-14 11:31:22 +01:00
parent c54eb185c0
commit 0f901f419a

View File

@ -253,10 +253,17 @@ ov::matcher_pass_callback ConvertReduceBase::convert_reduce_to_pooling() {
}
if (shape_end != input.get_shape()) {
input = std::make_shared<ov::opset1::Reshape>(
input,
ov::opset1::Constant::create(ov::element::i64, ov::Shape{shape_end.size()}, shape_end),
true);
if (shape_end == ov::Shape{}) {
input = std::make_shared<ov::opset1::Reshape>(
input,
ov::opset1::Constant::create(ov::element::i64, ov::Shape{1}, {0}),
false);
} else {
input = std::make_shared<ov::opset1::Reshape>(
input,
ov::opset1::Constant::create(ov::element::i64, ov::Shape{shape_end.size()}, shape_end),
true);
}
new_ops.push_back(input.get_node_shared_ptr());
}
input.get_node_shared_ptr()->set_friendly_name(reduce->get_friendly_name());