| 387 | } // namespace |
| 388 | |
| 389 | string SummarizeOpDef(const OpDef& op_def) { |
| 390 | string ret = strings::StrCat("Op<name=", op_def.name()); |
| 391 | strings::StrAppend(&ret, "; signature=", SummarizeArgs(op_def.input_arg()), |
| 392 | " -> ", SummarizeArgs(op_def.output_arg())); |
| 393 | for (int i = 0; i < op_def.attr_size(); ++i) { |
| 394 | strings::StrAppend(&ret, "; attr=", op_def.attr(i).name(), ":", |
| 395 | op_def.attr(i).type()); |
| 396 | if (op_def.attr(i).has_default_value()) { |
| 397 | strings::StrAppend(&ret, ",default=", |
| 398 | SummarizeAttrValue(op_def.attr(i).default_value())); |
| 399 | } |
| 400 | if (op_def.attr(i).has_minimum()) { |
| 401 | strings::StrAppend(&ret, ",min=", op_def.attr(i).minimum()); |
| 402 | } |
| 403 | if (op_def.attr(i).has_allowed_values()) { |
| 404 | strings::StrAppend(&ret, ",allowed=", |
| 405 | SummarizeAttrValue(op_def.attr(i).allowed_values())); |
| 406 | } |
| 407 | } |
| 408 | if (op_def.is_commutative()) { |
| 409 | strings::StrAppend(&ret, "; is_commutative=true"); |
| 410 | } |
| 411 | if (op_def.is_aggregate()) { |
| 412 | strings::StrAppend(&ret, "; is_aggregate=true"); |
| 413 | } |
| 414 | if (op_def.is_stateful()) { |
| 415 | strings::StrAppend(&ret, "; is_stateful=true"); |
| 416 | } |
| 417 | if (op_def.allows_uninitialized_input()) { |
| 418 | strings::StrAppend(&ret, "; allows_uninitialized_input=true"); |
| 419 | } |
| 420 | strings::StrAppend(&ret, ">"); |
| 421 | return ret; |
| 422 | } |
| 423 | |
| 424 | namespace { |
| 425 | |