Returns the name -> attr mapping of fdef's attrs that have a value set. In Python, it's possible to access unset attrs, which returns a default value and adds an unset attr to the map.
| 819 | // Python, it's possible to access unset attrs, which returns a default value |
| 820 | // and adds an unset attr to the map. |
| 821 | std::map<string, AttrValue> GetSetAttrs(const FunctionDef& fdef) { |
| 822 | std::map<string, AttrValue> set_attrs; |
| 823 | for (auto pair : fdef.attr()) { |
| 824 | if (pair.second.value_case() != AttrValue::VALUE_NOT_SET) { |
| 825 | set_attrs[pair.first] = pair.second; |
| 826 | } |
| 827 | } |
| 828 | return set_attrs; |
| 829 | } |
| 830 | |
| 831 | } // end namespace |
| 832 |
no test coverage detected