Skip to content

Commit

Permalink
style-apply
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-esir committed Dec 17, 2020
1 parent 5d54694 commit 93e82ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
38 changes: 17 additions & 21 deletions ngraph/core/src/op/gather_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ void op::v6::GatherElements::validate_and_infer_types()
set_output_type(0, data_type, indices_pshape);

NODE_VALIDATION_CHECK(
this,
data_rank.is_dynamic() ||
data_rank.get_length() >= 1,
"data rank must be >= 1.");
this, data_rank.is_dynamic() || data_rank.get_length() >= 1, "data rank must be >= 1.");

NODE_VALIDATION_CHECK(
this,
Expand All @@ -68,20 +65,20 @@ void op::v6::GatherElements::validate_and_infer_types()
"axis must be within interval (-data.rank, data.rank - 1). But instead Got: ",
m_axis);

NODE_VALIDATION_CHECK(
this,
indices_rank.is_dynamic() ||
indices_rank.get_length() >= 1,
"indices rank must be >= 1.");
NODE_VALIDATION_CHECK(this,
indices_rank.is_dynamic() || indices_rank.get_length() >= 1,
"indices rank must be >= 1.");

if (data_rank.is_static() && indices_rank.is_dynamic()){
if (data_rank.is_static() && indices_rank.is_dynamic())
{
PartialShape out_shape_info(data_pshape);
out_shape_info[axis] = Dimension::dynamic();
set_output_type(0, data_type, out_shape_info);
return;
}

if (data_rank.is_dynamic()){
if (data_rank.is_dynamic())
{
if (indices_rank.is_dynamic())
set_output_type(0, data_type, PartialShape::dynamic());
return;
Expand All @@ -105,16 +102,15 @@ void op::v6::GatherElements::validate_and_infer_types()
// (and if intervals intersect) then output_pshape will be {1, 4, 5}
Dimension curr_dim = data_pshape[i] & indices_pshape[i];

NODE_VALIDATION_CHECK(
this,
!curr_dim.get_interval().empty(),
"Shapes ",
data_pshape,
" and ",
indices_pshape,
" are not consistent. data and indices must have equal or "
"intersecting sizes, except for axis ",
m_axis);
NODE_VALIDATION_CHECK(this,
!curr_dim.get_interval().empty(),
"Shapes ",
data_pshape,
" and ",
indices_pshape,
" are not consistent. data and indices must have equal or "
"intersecting sizes, except for axis ",
m_axis);

output_pshape[i] = curr_dim;
}
Expand Down
3 changes: 2 additions & 1 deletion ngraph/test/type_prop/gather_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ TEST(type_prop, gather_elements_data_rank_static_indices_rank_dynamic)
auto I = make_shared<op::Parameter>(element::Type_t::i64, indices_shape);
auto GE = make_shared<op::v6::GatherElements>(D, I, axis);
ASSERT_EQ(GE->get_element_type(), element::Type_t::i8);
ASSERT_EQ(GE->get_output_partial_shape(0), PartialShape({Dimension::dynamic(), Dimension(1, 7), 5}));
ASSERT_EQ(GE->get_output_partial_shape(0),
PartialShape({Dimension::dynamic(), Dimension(1, 7), 5}));
}

TEST(type_prop, gather_elements_data_pshape_static_indices_rank_dynamic)
Expand Down

0 comments on commit 93e82ad

Please sign in to comment.