Commit 9fc9d66e by Zhennan Qin Committed by Tianqi Chen

Fix load subgraph from json (#1980)

parent 4bb40baa
......@@ -215,13 +215,6 @@ std::shared_ptr<Symbol> JSONGraph2Symbol(const JSONGraph &jgraph, bool no_parse)
for (uint32_t nid : n.control_deps) {
n.node->control_deps.push_back(jgraph.nodes[nid].node);
}
// rebuild attribute parser
if (!no_parse && n.node->op() != nullptr && n.node->op()->attr_parser != nullptr) {
n.node->op()->attr_parser(&(n.node->attrs));
} else if (!no_parse && n.node->is_variable()) {
n.node->attrs.parsed =
Symbol::CreateVariable(n.node->attrs.name).outputs[0].node->attrs.parsed;
}
for (const JSONGraph &subgraph : n.subgraphs) {
// The "no_parse" option here, is to be compatible with
// commit cfd3075e85807dcd8f9534c37e053583dee87524
......@@ -230,6 +223,13 @@ std::shared_ptr<Symbol> JSONGraph2Symbol(const JSONGraph &jgraph, bool no_parse)
// incubator-mxnet/src/nnvm/legacy_json_util.cc:UpgradeJSON_Parse
n.node->attrs.subgraphs.push_back(JSONGraph2Symbol(subgraph, false));
}
// rebuild attribute parser
if (!no_parse && n.node->op() != nullptr && n.node->op()->attr_parser != nullptr) {
n.node->op()->attr_parser(&(n.node->attrs));
} else if (!no_parse && n.node->is_variable()) {
n.node->attrs.parsed =
Symbol::CreateVariable(n.node->attrs.name).outputs[0].node->attrs.parsed;
}
}
// consistency check
for (uint32_t nid : jgraph.arg_nodes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment