Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix load subgraph from json #1980

Merged
merged 2 commits into from
Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions nnvm/src/pass/saveload_json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down