Skip to content

Commit

Permalink
Apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mangguo321 committed Jan 16, 2025
1 parent 8ae608d commit afcc6fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/src/op/if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ static ov::PartialShape resolve_shape(const ov::PartialShape& then_pshape, const
}
if (then_rank.get_length() != else_rank.get_length()) {
auto is_one_element = [](const ov::PartialShape& pshape) {
return pshape.size() == 0 || pshape[0].get_max_length() == 1;
return pshape.size() == 0 || (pshape.is_static() && pshape[0].get_length() == 1);
};
// Union of scalar and 1D case
if (then_rank.get_length() <= 1 && else_rank.get_length() <= 1) {
return (is_one_element(then_pshape) && is_one_element(else_pshape)) ?
ov::PartialShape{1} : ov::PartialShape::dynamic(1);
return (is_one_element(then_pshape) && is_one_element(else_pshape)) ? ov::PartialShape{1}
: ov::PartialShape::dynamic(1);
} else {
return ov::PartialShape::dynamic();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/tests/type_prop/if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ TEST(type_prop, if_output_one_element) {
if_op->set_input(Y, nullptr, Ye);
auto res = if_op->set_output(then_body_res, else_body_res);
auto result0 = make_shared<ov::op::v0::Result>(res);
PartialShape out_shape{PartialShape{1}};
PartialShape out_shape{1};
auto sh = result0->get_output_partial_shape(0);
EXPECT_EQ(sh, out_shape);
}
Expand Down

0 comments on commit afcc6fe

Please sign in to comment.