Various helpers Print(proto) to print relevant protos to ascii.
| 476 | |
| 477 | // Various helpers Print(proto) to print relevant protos to ascii. |
| 478 | string Print(const OpDef::ArgDef& arg) { |
| 479 | string out; |
| 480 | strings::StrAppend(&out, arg.name(), ":"); |
| 481 | if (arg.is_ref()) strings::StrAppend(&out, "Ref("); |
| 482 | if (!arg.number_attr().empty()) { |
| 483 | strings::StrAppend(&out, arg.number_attr(), "*"); |
| 484 | } |
| 485 | if (arg.type() != DT_INVALID) { |
| 486 | strings::StrAppend(&out, DataTypeString(arg.type())); |
| 487 | } else { |
| 488 | strings::StrAppend(&out, arg.type_attr()); |
| 489 | } |
| 490 | if (arg.is_ref()) strings::StrAppend(&out, ")"); |
| 491 | return out; |
| 492 | } |
| 493 | |
| 494 | // TODO(josh11b): Merge this with SummarizeAttrValue(). |
| 495 | string Print(const AttrValue& attr_value) { |