From 46a81b5c3490c8ff21521d7541a860491d27baa8 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Tue, 12 Sep 2017 17:22:11 -0700 Subject: Add cast S64 to F32 test. PiperOrigin-RevId: 168473650 --- tensorflow/compiler/xla/tests/scalar_computations_test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(&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 a_literal = Literal::CreateR0(value); + std::unique_ptr a_data = + client_->TransferToServer(*a_literal).ConsumeValueOrDie(); + ComputeAndCompareR0(&builder, static_cast(value), + {a_data.get()}); +} + XLA_TEST_F(ScalarComputationsTest, MulThreeScalarsF32) { ComputationBuilder builder(client_, TestName()); builder.Mul(builder.Mul(builder.ConstantR0(2.1f), -- cgit v1.2.3