Unverified Commit cfc848a7 by Tianqi Chen Committed by GitHub

[LANG] Improve serializer (#1658)

parent a1688998
......@@ -42,4 +42,6 @@ TVM_STATIC_IR_FUNCTOR(IRPrinter, vtable)
TVM_REGISTER_NODE_TYPE(DictAttrsNode);
TVM_REGISTER_NODE_TYPE(AttrFieldInfoNode);
} // namespace tvm
......@@ -236,6 +236,11 @@ class JSONAttrGetter : public AttrVisitor {
node_index_->at(kv.second.get()));
}
} else {
// do not need to recover content of global singleton object
// they are registered via the environment
auto* f = dmlc::Registry<NodeFactoryReg>::Find(node->type_key());
if (f != nullptr && f->fglobal_key != nullptr) return;
// recursively index normal object.
node->VisitAttrs(this);
}
}
......
......@@ -58,7 +58,8 @@ def test_make_attrs():
dattr = tvm.make.node("DictAttrs", x=1, y=10, name="xyz", padding=(0,0))
assert dattr.x.value == 1
datrr = tvm.load_json(tvm.save_json(dattr))
assert dattr.name.value == "xyz"
def test_make_sum():
......
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