aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_instruction_test.cc
diff options
context:
space:
mode:
authorGravatar Justin Lebar <jlebar@google.com>2018-08-30 21:07:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-30 21:10:58 -0700
commite1f0d2ef46690157045d0509a4117de5ed0c6187 (patch)
treea2615aa6e0224001c5a448a46c29ca8a98d0605c /tensorflow/compiler/xla/service/hlo_instruction_test.cc
parentca758d542f9cf5109728e8ae9cf8de8868932378 (diff)
[XLA] Add two new tests.
- Test operand_precision in HLO parser - Test that HloInstruction::Clone() preserves operand_precision. PiperOrigin-RevId: 211030698
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_instruction_test.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_instruction_test.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_instruction_test.cc b/tensorflow/compiler/xla/service/hlo_instruction_test.cc
index 81290ccd63..76b0e940a6 100644
--- a/tensorflow/compiler/xla/service/hlo_instruction_test.cc
+++ b/tensorflow/compiler/xla/service/hlo_instruction_test.cc
@@ -1739,5 +1739,23 @@ TEST_F(HloInstructionTest, CloneDnumsOnCustomCall) {
<< clone->convolution_dimension_numbers().DebugString();
}
+TEST_F(HloInstructionTest, PreserveOperandPrecisionOnCloneConv) {
+ constexpr char kHloString[] = R"(
+ HloModule test_module
+ ENTRY test {
+ arg0 = f32[1,2,1] parameter(0)
+ arg1 = f32[1,1,1] parameter(1)
+ ROOT conv = f32[1,2,1] convolution(arg0, arg1), window={size=1},
+ dim_labels=b0f_0io->b0f, operand_precision={high,default}
+ })";
+ TF_ASSERT_OK_AND_ASSIGN(auto module, ParseHloString(kHloString));
+ auto* conv = module->entry_computation()->root_instruction();
+
+ auto clone = conv->Clone();
+ EXPECT_THAT(clone->precision_config().operand_precision(),
+ ::testing::ElementsAre(PrecisionConfigProto::HIGH,
+ PrecisionConfigProto::DEFAULT));
+}
+
} // namespace
} // namespace xla