forked from mindspore-Ecosystem/mindspore
!49076 [MS][CPU] use isdynamicrank func replace origin code
Merge pull request !49076 from Greatpan/reduce_dynamic_rank
This commit is contained in:
commit
1882324ffd
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue