Add cast S64 to F32 test.
PiperOrigin-RevId: 168473650
This commit is contained in:
parent
59bdf598d2
commit
46a81b5c34
@ -151,6 +151,19 @@ XLA_TEST_F(ScalarComputationsTest, SubtractTwoScalarsS32) {
|
|||||||
ComputeAndCompareR0<int32>(&builder, -3, {});
|
ComputeAndCompareR0<int32>(&builder, -3, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XLA_TEST_F(ScalarComputationsTest, CastS64ToF32) {
|
||||||
|
ComputationBuilder builder(client_, TestName());
|
||||||
|
auto a = builder.Parameter(0, ShapeUtil::MakeShape(S64, {}), "a");
|
||||||
|
builder.ConvertElementType(a, F32);
|
||||||
|
|
||||||
|
int64 value = 3LL << 32;
|
||||||
|
std::unique_ptr<Literal> a_literal = Literal::CreateR0<int64>(value);
|
||||||
|
std::unique_ptr<GlobalData> a_data =
|
||||||
|
client_->TransferToServer(*a_literal).ConsumeValueOrDie();
|
||||||
|
ComputeAndCompareR0<float>(&builder, static_cast<float>(value),
|
||||||
|
{a_data.get()});
|
||||||
|
}
|
||||||
|
|
||||||
XLA_TEST_F(ScalarComputationsTest, MulThreeScalarsF32) {
|
XLA_TEST_F(ScalarComputationsTest, MulThreeScalarsF32) {
|
||||||
ComputationBuilder builder(client_, TestName());
|
ComputationBuilder builder(client_, TestName());
|
||||||
builder.Mul(builder.Mul(builder.ConstantR0<float>(2.1f),
|
builder.Mul(builder.Mul(builder.ConstantR0<float>(2.1f),
|
||||||
|
Loading…
Reference in New Issue
Block a user