forked from OSSInnovation/mindspore
bugfix(side effect): fix cell object cann't free normally.
This commit is contained in:
parent
c9fba7f091
commit
61e959a9f3
|
@ -640,8 +640,8 @@ FuncGraphPtr FuncGraph::GenerateGraph(const AbstractBasePtrList& args_spec_list)
|
|||
|
||||
void FuncGraph::add_parameter_obj_node(const AnfNodePtr& p) { paramter_obj_nodes_.push_back(p); }
|
||||
|
||||
std::list<CNodePtr> FuncGraph::GetOrderedCnodes(bool force_use_topo_sort) {
|
||||
if (has_flag(GRAPH_FLAG_HAS_EFFECT) && !force_use_topo_sort) {
|
||||
std::list<CNodePtr> FuncGraph::GetOrderedCnodes() {
|
||||
if (has_flag(GRAPH_FLAG_HAS_EFFECT)) {
|
||||
MS_LOG(DEBUG) << "Return ordered cnodes.";
|
||||
return order_;
|
||||
} else {
|
||||
|
@ -703,14 +703,14 @@ void FuncGraph::CheckOrder() {
|
|||
}
|
||||
}
|
||||
}
|
||||
auto topo_sort = GetOrderedCnodes(true);
|
||||
if (topo_sort.size() != order_.size()) {
|
||||
DumpCNodeList();
|
||||
DumpIR(ToString(), shared_from_base<FuncGraph>());
|
||||
MS_LOG(INFO) << "Dump graph: " << ToString() << ".";
|
||||
DumpFuncGraph(ToString());
|
||||
MS_LOG(EXCEPTION) << "CNode order size " << order_.size() << " is not equal to topo sort list size "
|
||||
<< topo_sort.size() << ".";
|
||||
auto mng = manager_.lock();
|
||||
if (mng != nullptr) {
|
||||
const auto& nodes = mng->nodes()[shared_from_base<FuncGraph>()];
|
||||
if (nodes.size() != (order_.size() + parameters_.size())) {
|
||||
DumpCNodeList();
|
||||
MS_LOG(EXCEPTION) << "CNode order size " << order_.size() << " is not equal to managed node size "
|
||||
<< nodes.size() - parameters_.size() << ".";
|
||||
}
|
||||
}
|
||||
MS_LOG(DEBUG) << "Check order okay.";
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ class FuncGraph : public FuncGraphBase {
|
|||
std::map<std::string, AnfNodePtr> parameter_default_value_;
|
||||
std::unordered_map<AnfNodePtr, AnfNodePtr> make_ref_params_;
|
||||
|
||||
std::list<CNodePtr> GetOrderedCnodes(bool force_use_topo_sort = false);
|
||||
std::list<CNodePtr> GetOrderedCnodes();
|
||||
void EraseUnusedNodeInOrder(const AnfNodePtr &n);
|
||||
void EraseUnusedNodeInOrder();
|
||||
void CheckOrder();
|
||||
|
|
Loading…
Reference in New Issue