[XLA] Add two new tests.

- Test operand_precision in HLO parser
- Test that HloInstruction::Clone() preserves operand_precision.

PiperOrigin-RevId: 211030698
This commit is contained in:
Justin Lebar 2018-08-30 21:07:17 -07:00 committed by TensorFlower Gardener
parent ca758d542f
commit e1f0d2ef46
2 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -382,7 +382,7 @@ ENTRY %Convolve1D1Window_0.v3 (input: f32[1,2,1], filter: f32[1,1,1]) -> f32[1,2
%input = f32[1,2,1]{2,1,0} parameter(0)
%copy = f32[1,2,1]{2,0,1} copy(f32[1,2,1]{2,1,0} %input)
%filter = f32[1,1,1]{2,1,0} parameter(1)
ROOT %convolution = f32[1,2,1]{2,0,1} convolution(f32[1,2,1]{2,0,1} %copy, f32[1,1,1]{2,1,0} %filter), window={size=1}, dim_labels=b0f_0io->b0f, feature_group_count=1
ROOT %convolution = f32[1,2,1]{2,0,1} convolution(f32[1,2,1]{2,0,1} %copy, f32[1,1,1]{2,1,0} %filter), window={size=1}, dim_labels=b0f_0io->b0f, feature_group_count=1, operand_precision={high,default}
}
)"