diff options
author | 2017-12-14 12:31:29 -0800 | |
---|---|---|
committer | 2017-12-14 12:35:10 -0800 | |
commit | a99b32fb149d028cd31fe638f81c6ca56c6e3b57 (patch) | |
tree | a393bbcca5f2aa6c7d506f8a998d194c448fb864 /tensorflow/compiler/xla/service/while_loop_simplifier.cc | |
parent | 4c86ece040cb96ea689f5c0d084b6959274eab91 (diff) |
[XLA] Gather the bool parameters into one thing to control the text format.
PiperOrigin-RevId: 179079727
Diffstat (limited to 'tensorflow/compiler/xla/service/while_loop_simplifier.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/while_loop_simplifier.cc | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tensorflow/compiler/xla/service/while_loop_simplifier.cc b/tensorflow/compiler/xla/service/while_loop_simplifier.cc index b2fd64a4d9..fb0e6f7ce0 100644 --- a/tensorflow/compiler/xla/service/while_loop_simplifier.cc +++ b/tensorflow/compiler/xla/service/while_loop_simplifier.cc @@ -306,6 +306,8 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { return false; } + auto print_no_metadata = HloPrintOptions().set_print_metadata(false); + // Bail if param0 of while_cond or while_body has users which aren't of type // get-tuple-element. for (const HloInstruction* instr : {while_body->parameter_instruction(0), @@ -313,9 +315,10 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { for (const HloInstruction* user : instr->users()) { if (user->opcode() != HloOpcode::kGetTupleElement) { VLOG(2) << "Cowardly refusing to analyze while loop with " - << instr->ToStringNoMetadata() - << " used by non-GTE instruction " << user->ToStringNoMetadata() - << " in computation " << instr->parent()->name(); + << instr->ToString(print_no_metadata) + << " used by non-GTE instruction " + << user->ToString(print_no_metadata) << " in computation " + << instr->parent()->name(); return false; } } @@ -351,7 +354,7 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { used_tuple_indices.insert(user->tuple_index()); if (used_tuple_indices.size() == tuple_size) { - VLOG(2) << "Loop " << while_op->ToStringNoMetadata() + VLOG(2) << "Loop " << while_op->ToString(print_no_metadata) << " uses all of its inputs; no simplification possible."; return false; } @@ -375,7 +378,7 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { used_tuple_indices.insert(i); if (used_tuple_indices.size() == tuple_size) { - VLOG(2) << "Loop " << while_op->ToStringNoMetadata() + VLOG(2) << "Loop " << while_op->ToString(print_no_metadata) << " uses all of its inputs; no simplification possible."; return false; } @@ -387,7 +390,8 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { CHECK_LT(used_tuple_indices.size(), tuple_size); VLOG(1) << "Eliminating " << tuple_size - used_tuple_indices.size() - << " elements from tuple of " << while_op->ToStringNoMetadata(); + << " elements from tuple of " + << while_op->ToString(print_no_metadata); // Build up maps from the old/new to the new/old tuple indices. std::vector<int64> new_to_old_tuple_idx(used_tuple_indices.begin(), @@ -431,7 +435,7 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { continue; } CHECK_EQ(user->opcode(), HloOpcode::kGetTupleElement) - << user->ToStringNoMetadata(); + << user->ToString(print_no_metadata); int64 old_idx = user->tuple_index(); auto new_idx_iter = old_to_new_tuple_idx.find(old_idx); @@ -446,14 +450,14 @@ static StatusOr<bool> TryRemoveDeadWhileParams(HloInstruction* while_op) { CHECK(user->user_count() == 0 || user->user_count() == 1 && user->users().front() == while_body_root) - << "Instruction " << user->ToStringNoMetadata() + << "Instruction " << user->ToString(print_no_metadata) << " should be unused (except by root of while body), but has " "users: {" << tensorflow::str_util::Join( user->users(), ", ", - [](string* out, const HloInstruction* instr) { + [&](string* out, const HloInstruction* instr) { tensorflow::strings::StrAppend( - out, instr->ToStringNoMetadata()); + out, instr->ToString(print_no_metadata)); }) << "}"; |