From adf47d3d922cde89fbfaad0101bcdd3e71773c48 Mon Sep 17 00:00:00 2001 From: zjun Date: Wed, 17 Mar 2021 16:43:32 +0800 Subject: [PATCH] Fix top cell bug Signed-off-by: zjun --- mindspore/ccsrc/pipeline/pynative/pynative_execute.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 404fcf2a768..be585740304 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -1647,7 +1647,7 @@ bool GradExecutor::IsTopGraph(const std::string &cell_id) { bool GradExecutor::IsTopestGraph(const std::string &cell_id) { return std::any_of(top_cell_list_.begin(), top_cell_list_.end(), [&cell_id](const TopCellInfoPtr &value) { - return value->cell_id() == cell_id && value->is_topest(); + return (value->cell_id() == cell_id || cell_id.find(value->cell_id()) != std::string::npos) && value->is_topest(); }); } @@ -1764,7 +1764,7 @@ void GradExecutor::ClearResidualRes(const std::string &cell_id) { return; } auto is_real_dynamic = pre_top_cell_->is_real_dynamic(); - if (is_real_dynamic) { + if (is_real_dynamic && cell_id == pre_top_cell_->cell_id()) { // Clear previous step resource auto resource = GetResource(cell_id); if (resource != nullptr && resource->results().find(pipeline::kBackend) != resource->results().end()) {