[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:
parent
ca758d542f
commit
e1f0d2ef46
@ -1739,5 +1739,23 @@ TEST_F(HloInstructionTest, CloneDnumsOnCustomCall) {
|
|||||||
<< clone->convolution_dimension_numbers().DebugString();
|
<< 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
|
||||||
} // namespace xla
|
} // namespace xla
|
||||||
|
@ -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)
|
%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)
|
%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)
|
%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}
|
||||||
}
|
}
|
||||||
|
|
||||||
)"
|
)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user