From 3342ebfb5f277e18d1fc6b0bbaf2da44c02cb7d9 Mon Sep 17 00:00:00 2001 From: yao_yf Date: Wed, 9 Dec 2020 17:25:01 +0800 Subject: [PATCH] redistribution_support_all_repeat_cal_when_dev_matrix_diff --- .../tensor_layout/redistribution_layout_transfer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 c6f1c741d9..e7e3a7c758 100644 --- a/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc +++ b/mindspore/ccsrc/frontend/parallel/tensor_layout/redistribution_layout_transfer.cc @@ -25,7 +25,11 @@ 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; - if (from_in_ != to_in_) { + 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; }); + 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(); MS_LOG(ERROR) << "to_in layout" << to_in_.ToString();