| 86 | } |
| 87 | |
| 88 | int64 GetIntAttr(const NodeDef& node, const string& attr_name) { |
| 89 | CHECK(HasAttr(node, attr_name)) << attr_name << " not found in:\n" |
| 90 | << node.DebugString(); |
| 91 | const auto& attr = node.attr().at(attr_name); |
| 92 | CHECK_EQ(attr.value_case(), AttrValue::kI); |
| 93 | return attr.i(); |
| 94 | } |
| 95 | |
| 96 | float GetFloatAttr(const NodeDef& node, const string& attr_name) { |
| 97 | CHECK(HasAttr(node, attr_name)); |