Skip to content

Commit

Permalink
[XLA] Augment metadata output with source-line info, as before.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 168292527
  • Loading branch information
tensorflower-gardener committed Sep 11, 2017
1 parent 3491881 commit 3a98035
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tensorflow/compiler/xla/service/hlo_graph_dumper.cc
Expand Up @@ -811,13 +811,25 @@ string HloDotDumper::GetInstructionNodeLabel(const HloInstruction* instr) {
}

string HloDotDumper::GetInstructionNodeMetadata(const HloInstruction* instr) {
if (!show_metadata_ || instr->metadata().op_name().empty()) {
if (!show_metadata_) {
return "";
}

return Printf(R"(%s<br/>op_type: %s)",
HtmlLikeStringSanitize(instr->metadata().op_name()),
HtmlLikeStringSanitize(instr->metadata().op_type()));
std::vector<string> lines;
if (!instr->metadata().op_name().empty()) {
lines.push_back(HtmlLikeStringSanitize(instr->metadata().op_name()));
}
if (!instr->metadata().op_type().empty()) {
lines.push_back(Printf(
"op_type: %s", HtmlLikeStringSanitize(instr->metadata().op_type())));
}
if (!instr->metadata().source_file().empty() &&
instr->metadata().source_line() != 0) {
lines.push_back(Printf("op_type: %s", instr->metadata().source_file(),
instr->metadata().source_line()));
}

return Join(lines, "<br/>");
}

string HloDotDumper::GetInstructionNodeExtraInfo(const HloInstruction* instr) {
Expand Down

0 comments on commit 3a98035

Please sign in to comment.