Commit 35f36fa4 by Joshua Z. Zhang Committed by Tianqi Chen

fix symbol.attr('op_name') (#149)

parent b931f8e2
...@@ -484,7 +484,11 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const { ...@@ -484,7 +484,11 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const {
*out = node->attrs.name; *out = node->attrs.name;
return true; return true;
} else if (key == "op_name") { } else if (key == "op_name") {
*out = node->attrs.op->name; if (node->attrs.op != nullptr) {
*out = node->attrs.op->name;
} else {
*out = "null"; // use null in consistant with json
}
return true; return true;
} }
auto it = node->attrs.dict.find(key); auto it = node->attrs.dict.find(key);
......
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