| 46 | } // namespace |
| 47 | |
| 48 | string StripLogHeaders(const string& hlo_string) { |
| 49 | // I0521 12:04:45.883483 1509 service.cc:186] ... |
| 50 | static RE2* matcher = new RE2( |
| 51 | "[IWEF]\\d{4} " |
| 52 | "\\d{2}:\\d{2}:\\d{2}\\.\\d+\\s+\\d+\\s+[^:]+:\\d+\\]\\s?(.*)"); |
| 53 | absl::string_view matches[4]; |
| 54 | std::vector<string> lines = absl::StrSplit(hlo_string, '\n'); |
| 55 | for (auto& line : lines) { |
| 56 | if (matcher->Match(line, 0, line.size(), RE2::ANCHOR_START, matches, 4)) { |
| 57 | line = string(matches[1]); |
| 58 | } |
| 59 | } |
| 60 | return absl::StrJoin(lines, "\n", [](string* out, const string& line) { |
| 61 | absl::StrAppend(out, line); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | StatusOr<std::unique_ptr<HloModule>> LoadModuleFromData( |
| 66 | const string& data, const string& format, |
no test coverage detected