Commit c1a7b28b by ziheng Committed by Tianqi Chen

[SYMBOL] Enable get index from symbol (#286)

parent 669e9c15
...@@ -495,6 +495,15 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const { ...@@ -495,6 +495,15 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const {
*out = "null"; // use null with json *out = "null"; // use null with json
} }
return true; return true;
} else if (key == "_value_index") {
*out = "";
for (size_t i = 0; i < outputs.size(); ++i) {
if (i != 0) {
*out += ", ";
}
*out += std::to_string(outputs[i].index);
}
return true;
} }
auto it = node->attrs.dict.find(key); auto it = node->attrs.dict.find(key);
if (it == node->attrs.dict.end()) return false; if (it == node->attrs.dict.end()) return false;
......
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