From a7fcec1b6e4832d03d796c3437c1fb00577ffc5c Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 17 May 2018 17:40:47 -0700 Subject: [PATCH] Handle HloInstruction::ToString() when literal is missing. PiperOrigin-RevId: 197079144 --- tensorflow/compiler/xla/service/hlo_instruction.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc index 66ff111..db1c33e 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction.cc @@ -2151,9 +2151,12 @@ string HloInstruction::OperandsToStringWithCanonicalNameMap( string operands; if (opcode() == HloOpcode::kConstant) { // For constants, show the actual value in place of an empty operand list. - if ((!ShapeUtil::IsTuple(shape()) && - ShapeUtil::ElementsIn(shape()) <= 10) || - options.print_large_constants()) { + // + // In HloInstruction, sometimes a constant literal is not constructed due + // to its size. Skip the printing in this case. + if (HasLiteral() && ((!ShapeUtil::IsTuple(shape()) && + ShapeUtil::ElementsIn(shape()) <= 10) || + options.print_large_constants())) { // Literal::ToString emits multidimensional arrays over multiple // lines. Compact this into one line by stripping out white space. string tmp = literal().ToString(); -- 2.7.4