!41910 fix check somas error

Merge pull request !41910 from 王禹程/fix_1.9
This commit is contained in:
i-robot 2022-09-14 09:05:18 +00:00 committed by Gitee
commit 37afe1cc2f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 6 additions and 4 deletions

View File

@ -27,11 +27,13 @@ constexpr auto kNopNodeRealInputIndex = 1;
bool InsertTensorMoveForGraphOutputRefNode::Run(const FuncGraphPtr &graph) {
MS_EXCEPTION_IF_NULL(graph);
auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr);
if (context_ptr->get_param<int>(MS_CTX_MEMORY_OPTIMIZE_LEVEL) == kOptimizeO0) {
auto ms_context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(ms_context);
auto task_sink = ms_context->get_param<bool>(MS_CTX_ENABLE_TASK_SINK);
auto opt_level = ms_context->get_param<int>(MS_CTX_MEMORY_OPTIMIZE_LEVEL);
if (!task_sink && (opt_level == kOptimizeO0)) {
// not use somas
return true;
return false;
}
// Need to insert TensorMove if the output of RefOp is GraphOutput