| 679 | namespace { // Helpers for NameRangesForNode() |
| 680 | |
| 681 | Status ComputeArgRange(const AttrSlice& attrs, const OpDef::ArgDef& arg_def, |
| 682 | const OpDef& op_def, int* num) { |
| 683 | if (!arg_def.number_attr().empty()) { |
| 684 | // Same type repeated "num" times. |
| 685 | return GetNodeAttr(attrs, arg_def.number_attr(), num); |
| 686 | } else if (!arg_def.type_list_attr().empty()) { |
| 687 | const AttrValue* attr_value; |
| 688 | TF_RETURN_IF_ERROR(attrs.Find(arg_def.type_list_attr(), &attr_value)); |
| 689 | *num = attr_value->list().type_size(); |
| 690 | } else if (!arg_def.type_attr().empty() || arg_def.type() != DT_INVALID) { |
| 691 | *num = 1; |
| 692 | } else { |
| 693 | return errors::InvalidArgument( |
| 694 | "Argument '", arg_def.name(), |
| 695 | "' incorrectly specified in op definition: ", SummarizeOpDef(op_def)); |
| 696 | } |
| 697 | return Status::OK(); |
| 698 | } |
| 699 | |
| 700 | Status NameRangesHelper(const AttrSlice& attrs, |
| 701 | const protobuf::RepeatedPtrField<OpDef::ArgDef>& args, |
no test coverage detected