Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

[JSON] attr->attrs in node attribute, keep backward read compatible #152

Merged
merged 1 commit into from
Sep 29, 2017
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
4 changes: 3 additions & 1 deletion src/pass/saveload_json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct JSONNode {
// write attributes in order;
std::map<std::string, std::string> dict(
node->attrs.dict.begin(), node->attrs.dict.end());
writer->WriteObjectKeyValue("attr", dict);
writer->WriteObjectKeyValue("attrs", dict);
}
writer->WriteObjectKeyValue("inputs", inputs);
if (control_deps.size() != 0) {
Expand All @@ -96,6 +96,7 @@ struct JSONNode {
helper.DeclareField("op", &op_type_str);
helper.DeclareField("name", &(node->attrs.name));
helper.DeclareField("inputs", &inputs);
helper.DeclareOptionalField("attrs", &(node->attrs.dict));
helper.DeclareOptionalField("attr", &(node->attrs.dict));
helper.DeclareOptionalField("control_deps", &control_deps);
// backward compatible code with mxnet graph.
Expand Down Expand Up @@ -257,6 +258,7 @@ NNVM_REGISTER_PASS(SaveJSON)

DMLC_JSON_ENABLE_ANY(std::string, str);
DMLC_JSON_ENABLE_ANY(std::vector<int>, list_int);
DMLC_JSON_ENABLE_ANY(std::vector<std::string>, list_str);

} // namespace
} // namespace pass
Expand Down