MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / StripLogHeaders

Function StripLogHeaders

tensorflow/compiler/xla/tools/hlo_module_loader.cc:48–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46} // namespace
47
48string 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
65StatusOr<std::unique_ptr<HloModule>> LoadModuleFromData(
66 const string& data, const string& format,

Callers 1

LoadModuleFromDataFunction · 0.85

Calls 3

StrAppendFunction · 0.50
MatchMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected