diff --git a/tensorflow/compiler/xla/tests/scalar_computations_test.cc b/tensorflow/compiler/xla/tests/scalar_computations_test.cc index f3cbc013238..77d1c019f3a 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), diff --git a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py index 6748a765623..0578ae8b0f4 100644 --- a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py +++ b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py @@ -68,12 +68,11 @@ def _create_global_step(graph): return variable_scope.get_variable( ops.GraphKeys.GLOBAL_STEP, shape=[], - dtype=dtypes.int32, + dtype=dtypes.int64, initializer=init_ops.zeros_initializer(), trainable=False, use_resource=True, - collections=[ops.GraphKeys.GLOBAL_VARIABLES, - ops.GraphKeys.GLOBAL_STEP]) + collections=[ops.GraphKeys.GLOBAL_VARIABLES, ops.GraphKeys.GLOBAL_STEP]) def _sync_variables_ops():