| 3430 | } |
| 3431 | |
| 3432 | string OpMetadataToString(const OpMetadata& metadata) { |
| 3433 | std::vector<string> result; |
| 3434 | if (!metadata.op_type().empty()) { |
| 3435 | result.push_back(StrCat("op_type=\"", CEscape(metadata.op_type()), "\"")); |
| 3436 | } |
| 3437 | if (!metadata.op_name().empty()) { |
| 3438 | result.push_back(StrCat("op_name=\"", CEscape(metadata.op_name()), "\"")); |
| 3439 | } |
| 3440 | if (!metadata.source_file().empty()) { |
| 3441 | result.push_back( |
| 3442 | StrCat("source_file=\"", CEscape(metadata.source_file()), "\"")); |
| 3443 | } |
| 3444 | if (metadata.source_line() != 0) { |
| 3445 | result.push_back(StrCat("source_line=", metadata.source_line())); |
| 3446 | } |
| 3447 | return StrJoin(result, " "); |
| 3448 | } |
| 3449 | |
| 3450 | string RandomDistributionToString(const RandomDistribution& distribution) { |
| 3451 | return absl::AsciiStrToLower(RandomDistribution_Name(distribution)); |