From 73dbc8e7ae72bb87c2ba0caea6abe4701bcfd1d8 Mon Sep 17 00:00:00 2001 From: yao_yf Date: Mon, 14 Dec 2020 20:45:05 +0800 Subject: [PATCH] fix_auto_parallel_dynamic_shape_map_set --- .../tensor_layout/redistribution_layout_transfer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc b/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc index e7e3a7c758b..293d968c414 100644 --- a/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc +++ b/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc @@ -25,10 +25,10 @@ Status RedistributionLayoutTransfer::CheckValidTransfer() { Shape from_shape = from_in_.tensor_shape().array(); if (std::find(from_shape.begin(), from_shape.end(), -1) != from_shape.end()) { is_dynamic_shape_ = true; - bool not_all_repeat = std::any_of(from_in_.tensor_map().array().begin(), from_in_.tensor_map().array().end(), - [](int64_t i) { return i != -1; }) || - std::any_of(to_in_.tensor_map().array().begin(), to_in_.tensor_map().array().end(), - [](int64_t i) { return i != -1; }); + Shape from_map = from_in_.tensor_map().array(); + Shape to_map = to_in_.tensor_map().array(); + bool not_all_repeat = std::any_of(from_map.begin(), from_map.end(), [](int64_t i) { return i != -1; }) || + std::any_of(to_map.begin(), to_map.end(), [](int64_t i) { return i != -1; }); if (from_in_ != to_in_ && not_all_repeat) { MS_LOG(ERROR) << "In dynamic shape scene, the from_tensor_shape should be equal to to_tensor_shape"; MS_LOG(ERROR) << "from_in layout" << from_in_.ToString();