!49273 Fix dynamic rank bug of reshape

Merge pull request !49273 from chenfei_mindspore/master
This commit is contained in:
i-robot 2023-02-24 03:02:52 +00:00 committed by Gitee
commit fe32b252c5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 0 deletions

View File

@ -64,6 +64,9 @@ ShapeVector update_shape(const std::vector<int> &padding_axis_value, const Shape
for (int64_t value : shape) { for (int64_t value : shape) {
shape_num = LongMulWithOverflowCheck(value, shape_num); shape_num = LongMulWithOverflowCheck(value, shape_num);
} }
if (shape_num == abstract::Shape::kShapeRankAny) {
return {abstract::Shape::kShapeRankAny};
}
if (shape_num != x_num) { if (shape_num != x_num) {
MS_EXCEPTION(ValueError) << "The accumulate of x_shape must be equal to out_shape, but got x_shape: " << x_shape MS_EXCEPTION(ValueError) << "The accumulate of x_shape must be equal to out_shape, but got x_shape: " << x_shape
<< ", and out_shape: " << shape; << ", and out_shape: " << shape;