diff options
author | 2017-09-12 17:22:11 -0700 | |
---|---|---|
committer | 2017-09-12 17:25:50 -0700 | |
commit | 46a81b5c3490c8ff21521d7541a860491d27baa8 (patch) | |
tree | 8699b9dcdcb6469d3ae1951458e09ca3830d57f1 | |
parent | 59bdf598d2cf386507aab4e56c5ffffcaebcb880 (diff) |
Add cast S64 to F32 test.
PiperOrigin-RevId: 168473650
-rw-r--r-- | tensorflow/compiler/xla/tests/scalar_computations_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/tests/scalar_computations_test.cc b/tensorflow/compiler/xla/tests/scalar_computations_test.cc index f3cbc01323..77d1c019f3 100644 --- a/tensorflow/compiler/xla/tests/scalar_computations_test.cc +++ b/tensorflow/compiler/xla/tests/scalar_computations_test.cc @@ -151,6 +151,19 @@ XLA_TEST_F(ScalarComputationsTest, SubtractTwoScalarsS32) { 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) { ComputationBuilder builder(client_, TestName()); builder.Mul(builder.Mul(builder.ConstantR0<float>(2.1f), |