From 68c4a9c00d4025f9ade5abbc3c177fc98fe0de8e Mon Sep 17 00:00:00 2001 From: Henry Shi Date: Fri, 29 Jul 2022 00:16:09 +0800 Subject: [PATCH] slice infer --- mindspore/core/ops/slice.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/mindspore/core/ops/slice.cc b/mindspore/core/ops/slice.cc index 4479ef09481..c7ebec6a986 100644 --- a/mindspore/core/ops/slice.cc +++ b/mindspore/core/ops/slice.cc @@ -100,12 +100,7 @@ abstract::ShapePtr SliceInferShape(const PrimitivePtr &primitive, const std::vec MS_EXCEPTION(ValueError) << "For Slice, the shape of input|begin|size must be equal."; } (void)CheckAndConvertUtils::CheckPositiveVector("input_begin", input_begin_value, prim_name); - bool is_dynamic = false; for (size_t i = 0; i < rank; ++i) { - if (input_x_shape[i] < 0) { - is_dynamic = true; - continue; - } if (input_begin_value[i] + input_size_value[i] > input_x_shape[i]) { MS_EXCEPTION(ValueError) << "For Slice, the sum of begin_shape[" << i << "] and size_shape[" << i << "] must be no greater than input_x_shape[" << i << "]."; @@ -116,11 +111,7 @@ abstract::ShapePtr SliceInferShape(const PrimitivePtr &primitive, const std::vec out_shape_min[i] = input_size_value[i]; out_shape_max[i] = input_size_value[i]; } - if (!is_dynamic) { - return std::make_shared(input_size_value); - } else { - return std::make_shared(input_size_value, out_shape_min, out_shape_max); - } + return std::make_shared(input_size_value); } TypePtr SliceInferType(const PrimitivePtr &primitive, const std::vector &input_args) {