diff --git a/src/core/shape_inference/include/dimension_util.hpp b/src/core/shape_inference/include/dimension_util.hpp index 6fa4cfd7bf9..5d96708d050 100644 --- a/src/core/shape_inference/include/dimension_util.hpp +++ b/src/core/shape_inference/include/dimension_util.hpp @@ -161,7 +161,7 @@ auto ceil_div(const TDim& dim, const typename TDim::value_type divisor) -> TDim if (dim.is_static()) { return {util::ceil_div(dim.get_length(), divisor)}; } else if (dim.get_max_length() == static_cast(dim::inf_bound)) { - return {dim}; + return {util::ceil_div(dim.get_min_length(), divisor), dim.get_max_length()}; } else { return {util::ceil_div(dim.get_min_length(), divisor), util::ceil_div(dim.get_max_length(), divisor)}; } @@ -183,7 +183,7 @@ auto floor_div(const TDim& dim, const typename TDim::value_type divisor) -> TDim if (dim.is_static()) { return {dim.get_length() / divisor}; } else if (dim.get_max_length() == static_cast(dim::inf_bound)) { - return {dim}; + return {dim.get_min_length() / divisor, dim.get_max_length()}; } else { return {dim.get_min_length() / divisor, dim.get_max_length() / divisor}; } diff --git a/src/core/tests/type_prop/binary_convolution.cpp b/src/core/tests/type_prop/binary_convolution.cpp index e09b09966ee..d40651cd543 100644 --- a/src/core/tests/type_prop/binary_convolution.cpp +++ b/src/core/tests/type_prop/binary_convolution.cpp @@ -130,7 +130,7 @@ TEST(type_prop, bin_convolution_auto_padding_same_data_batch_spatial_dims_dynami pad_value, auto_pad); - EXPECT_THAT(get_shape_labels(conv->get_output_partial_shape(0)), ElementsAre(10, 20, 12, ov::no_label)); + EXPECT_THAT(get_shape_labels(conv->get_output_partial_shape(0)), ElementsAre(10, 20, ov::no_label, ov::no_label)); EXPECT_EQ(conv->get_output_partial_shape(0), (PartialShape{1, Dimension::dynamic(), Dimension::dynamic(), 5})); EXPECT_EQ(conv->get_pads_begin(), (CoordinateDiff{0, 1})); EXPECT_EQ(conv->get_pads_end(), (CoordinateDiff{0, 1})); diff --git a/src/core/tests/type_prop/convolution.cpp b/src/core/tests/type_prop/convolution.cpp index f26899d58a7..fee50bb7d16 100644 --- a/src/core/tests/type_prop/convolution.cpp +++ b/src/core/tests/type_prop/convolution.cpp @@ -117,7 +117,7 @@ TEST(type_prop, convolution_v1_partial_auto_padding_same_spatial_dims_dynamic) { make_shared(data_batch, filters, strides, pads_begin, pads_end, dilations, auto_pad); EXPECT_EQ(conv->get_output_partial_shape(0), PartialShape({1, 1, Dimension::dynamic(), {2, 3}})); - EXPECT_THAT(get_shape_labels(conv->get_output_partial_shape(0)), ElementsAre(10, 20, 12, ov::no_label)); + EXPECT_THAT(get_shape_labels(conv->get_output_partial_shape(0)), ElementsAre(10, 20, ov::no_label, ov::no_label)); EXPECT_EQ(conv->get_pads_begin(), (CoordinateDiff{0, 0})); EXPECT_EQ(conv->get_pads_end(), (CoordinateDiff{0, 0})); } diff --git a/src/core/tests/type_prop/max_pool.cpp b/src/core/tests/type_prop/max_pool.cpp index 5880cc426d9..b3523fa6dda 100644 --- a/src/core/tests/type_prop/max_pool.cpp +++ b/src/core/tests/type_prop/max_pool.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "dimension_util.hpp" #include "gtest/gtest.h" #include "ngraph/ngraph.hpp" #include "util/type_prop.hpp" @@ -271,6 +272,44 @@ TEST(type_prop, max_pool_v8_4D_with_dilations) { EXPECT_EQ(mp->get_output_partial_shape(1), expected_output_shape); } +TEST(type_prop, max_pool_v8_4D_dynamic_dims_with_non_zero_low_range_floor_mode) { + PartialShape arg_shape{Dimension::dynamic(), 64, {198, ov::util::dim::inf_bound}, {198, ov::util::dim::inf_bound}}; + const Strides strides{2, 2}; + const Strides dilations{1, 1}; + const Shape pads_begin{0, 0}; + const Shape pads_end{0, 0}; + const Shape kernel_shape{2, 2}; + const auto rounding_mode = op::RoundingType::FLOOR; + + const auto arg = make_shared(element::f32, arg_shape); + const auto mp = + make_shared(arg, strides, dilations, pads_begin, pads_end, kernel_shape, rounding_mode); + + const auto expected_output_shape = + PartialShape{Dimension::dynamic(), 64, {99, ov::util::dim::inf_bound}, {99, ov::util::dim::inf_bound}}; + EXPECT_EQ(mp->get_output_partial_shape(0), expected_output_shape); + EXPECT_EQ(mp->get_output_partial_shape(1), expected_output_shape); +} + +TEST(type_prop, max_pool_v8_4D_dynamic_dims_with_non_zero_low_range_ceil_mode) { + PartialShape arg_shape{Dimension::dynamic(), 64, {198, ov::util::dim::inf_bound}, {198, ov::util::dim::inf_bound}}; + const Strides strides{2, 2}; + const Strides dilations{1, 1}; + const Shape pads_begin{0, 0}; + const Shape pads_end{0, 0}; + const Shape kernel_shape{2, 2}; + const auto rounding_mode = op::RoundingType::CEIL; + + const auto arg = make_shared(element::f32, arg_shape); + const auto mp = + make_shared(arg, strides, dilations, pads_begin, pads_end, kernel_shape, rounding_mode); + + const auto expected_output_shape = + PartialShape{Dimension::dynamic(), 64, {99, ov::util::dim::inf_bound}, {99, ov::util::dim::inf_bound}}; + EXPECT_EQ(mp->get_output_partial_shape(0), expected_output_shape); + EXPECT_EQ(mp->get_output_partial_shape(1), expected_output_shape); +} + TEST(type_prop, max_pool_v8_4D_interval_dims_with_dilations) { PartialShape arg_shape{{2, 3}, {1, 3}, {2, 13}, {6, 13}}; set_shape_labels(arg_shape, 10);