From d00545a669307d2fcd2aa465600bee34c30544c8 Mon Sep 17 00:00:00 2001 From: "Joshua Z. Zhang" Date: Wed, 20 Sep 2017 19:53:37 -0700 Subject: [PATCH] fix symbol.attr('op_name') (#149) --- src/core/symbolic.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/symbolic.cc b/src/core/symbolic.cc index 5099e1f4920b..2b6500502f74 100644 --- a/src/core/symbolic.cc +++ b/src/core/symbolic.cc @@ -484,7 +484,11 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const { *out = node->attrs.name; return true; } 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; } auto it = node->attrs.dict.find(key);