Commit 5bf1cbda by reminisce Committed by Tianqi Chen

Fix saveload json bug (#1831)

parent 51d2e126
......@@ -218,6 +218,9 @@ std::shared_ptr<Symbol> JSONGraph2Symbol(const JSONGraph &jgraph, bool no_parse)
// 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
......
import nnvm
from tvm.contrib import util
def test_variable_node_parsed():
sym = nnvm.sym.Variable('data')
tempdir = util.tempdir()
json_filename = 'test_nnvm_symbol.json'
with open(tempdir.relpath(json_filename), 'w') as fo:
fo.write(nnvm.graph.create(sym).json())
sym_str = open(tempdir.relpath(json_filename), 'r').read()
sym = nnvm.graph.load_json(sym_str).symbol()
sym = nnvm.sym.relu(sym)
if __name__ == '__main__':
test_variable_node_parsed()
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