From 01be8f87940153b708ee1076648f3d030c35ca02 Mon Sep 17 00:00:00 2001 From: huangdongrun Date: Wed, 22 Apr 2020 20:58:33 +0800 Subject: [PATCH] for constant input ,do not need to generate phi node fix error while do not need ignore vale --- mindspore/ccsrc/pipeline/parse/parse.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/pipeline/parse/parse.cc b/mindspore/ccsrc/pipeline/parse/parse.cc index 82d254d2fc..dac84c6006 100644 --- a/mindspore/ccsrc/pipeline/parse/parse.cc +++ b/mindspore/ccsrc/pipeline/parse/parse.cc @@ -600,9 +600,11 @@ AnfNodePtr Parser::ParseAttribute(const FunctionBlockPtr &block, const py::objec std::string var_name = "self."; std::string attr_name = node.attr("attr").cast(); (void)var_name.append(attr_name); - auto obj = ast()->obj().attr(attr_name.c_str()); + auto attr_obj = ast()->obj().attr(attr_name.c_str()); if (py::hasattr(ast()->obj(), attr_name.c_str()) && - (data_converter::IsCellInstance(obj) || py::hasattr(obj, PYTHON_PRIMITIVE_FLAG))) { + (py::hasattr(attr_obj, PYTHON_PRIMITIVE_FLAG) || py::isinstance(attr_obj) || + py::isinstance(attr_obj) || py::isinstance(attr_obj) || + py::isinstance(attr_obj) || data_converter::IsCellInstance(attr_obj))) { return block->MakeResolveSymbol(var_name); } else { return block->ReadVariable(var_name); @@ -944,9 +946,6 @@ FunctionBlockPtr Parser::ParseWhile(const FunctionBlockPtr &block, const py::obj MS_LOG(INFO) << "Parse while statement"; TraceManager::DebugTrace(std::make_shared(block->func_graph()->debug_info())); FunctionBlockPtr header_block = MakeFunctionBlock(*this); - if (MsContext::GetInstance()->is_multi_graph_sink()) { - header_block->func_graph()->set_flags(FUNC_GRAPH_FLAG_IGNORE_VALUES, true); - } TraceManager::EndTrace(); TraceManager::DebugTrace(std::make_shared(block->func_graph()->debug_info()));