!49076 [MS][CPU] use isdynamicrank func replace origin code

Merge pull request !49076 from Greatpan/reduce_dynamic_rank
This commit is contained in:
i-robot 2023-02-20 01:11:29 +00:00 committed by Gitee
commit 1882324ffd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 1 additions and 1 deletions

View File

@ -154,7 +154,7 @@ AnfNodePtr ReduceOptimizer::NewAssistValueNode(const CNodePtr &cnode, const Kern
// case 2: contain value less 0;
for (auto &iter : value_tuple->value()) {
auto item = GetValue<int64_t>(iter->cast<ScalarPtr>());
if (item < 0 && !(x_shape->shape().size() == 1 && x_shape->shape()[0] == -2)) { // -2 : dynamic rank
if (item < 0 && !(IsDynamicRank(x_shape->shape()))) {
(void)axis_value.emplace_back(item + static_cast<int64_t>(x_shape->shape().size()));
} else {
(void)axis_value.emplace_back(item);