| 681 | } |
| 682 | |
| 683 | Status AddDefaultAttrs(const string& op, |
| 684 | const GetFunctionSignature& get_function, |
| 685 | AttrValueMap* attrs) { |
| 686 | const OpDef* op_def = nullptr; |
| 687 | TF_RETURN_IF_ERROR(get_function(op, &op_def)); |
| 688 | AttrSlice attr_slice(attrs); |
| 689 | for (const auto& attr_def : op_def->attr()) { |
| 690 | if (attr_def.has_default_value() && !attr_slice.Find(attr_def.name())) { |
| 691 | if (!attrs->insert({attr_def.name(), attr_def.default_value()}).second) { |
| 692 | return errors::Internal("Somehow duplicated: ", attr_def.name()); |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | return Status::OK(); |
| 697 | } |
| 698 | |
| 699 | } // end namespace |
| 700 |
no test coverage detected