diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-12-13 15:22:39 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-13 15:28:40 -0800 |
commit | e2e15df4175a3c13aa550b17bad4bb5d92185e7e (patch) | |
tree | 3d1110cbda66821f1ee4d75793806116647458fa /tensorflow/compiler/xla/service/hlo_instruction_test.cc | |
parent | d80d6de2890112f0013ffede31767907ec3291ca (diff) |
[XLA] Update parser to handle conditional. Also fix the stringification of
conditional HloInstruction.
PiperOrigin-RevId: 178966782
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_instruction_test.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_instruction_test.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_instruction_test.cc b/tensorflow/compiler/xla/service/hlo_instruction_test.cc index aa3fd0cf4f..54788fa2da 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction_test.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction_test.cc @@ -1130,7 +1130,7 @@ TEST_F(HloInstructionTest, CloneSuffixNames) { } TEST_F(HloInstructionTest, Stringification) { - // Tests stringification of a simple op, fusion, and while. + // Tests stringification of a simple op, fusion, while, and conditional. const Shape s1 = ShapeUtil::MakeShape(F32, {5, 10}); const Shape s2 = ShapeUtil::MakeShape(F32, {20, 10}); const Shape s2t = ShapeUtil::MakeShape(F32, {10, 20}); @@ -1168,6 +1168,16 @@ TEST_F(HloInstructionTest, Stringification) { EXPECT_EQ(loop->ToString(false, false), "%while = f32[5,20]{1,0} while(f32[5,10]{1,0} %x), " "condition=%TransposeDot, body=%TransposeDot"); + + auto pred = builder.AddInstruction( + HloInstruction::CreateConstant(Literal::CreateR0<bool>(true))); + HloInstruction* conditional = + builder.AddInstruction(HloInstruction::CreateConditional( + sout, pred, x, computation, x, computation)); + EXPECT_EQ(conditional->ToString(false, false), + "%conditional = f32[5,20]{1,0} conditional(pred[] %constant, " + "f32[5,10]{1,0} %x, f32[5,10]{1,0} %x), " + "true_computation=%TransposeDot, false_computation=%TransposeDot"); } } // namespace |