Skip to content

Commit d27fbb4

Browse files
Merge pull request #52765 from pranve/cherrypick-9294094df6fea79271778eb7e7ae1bad8b5ef98f-on-r2.6
Merge pull request #51138 from yongtang:46911-tile
2 parents dd68305 + cbe7645 commit d27fbb4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tensorflow/core/kernels/tile_ops.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ class TileOp : public OpKernel {
188188
context, multiples_array[i] >= 0,
189189
errors::InvalidArgument("Expected multiples[", i, "] >= 0, but got ",
190190
multiples_array[i]));
191-
output_shape.AddDim(input.dim_size(i) * multiples_array[i]);
191+
OP_REQUIRES_OK(context, output_shape.AddDimWithStatus(
192+
input.dim_size(i) * multiples_array[i]));
192193
}
193194
if (output_shape == input.shape()) {
194195
context->set_output(0, input);

tensorflow/python/kernel_tests/shape_ops_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,17 @@ def testShapeFunctionEdgeCases(self):
723723
inp, array_ops.placeholder(
724724
dtypes.int32, shape=[3]))
725725

726+
def testLargeTensor(self):
727+
# Test case for GItHub issue 46911.
728+
if test_util.is_xla_enabled():
729+
# The following test fails with XLA enabled.
730+
return
731+
with self.assertRaises(errors_impl.InternalError):
732+
with self.cached_session():
733+
tiled = array_ops.tile(
734+
np.ones((1, 1, 1)), [100000000, 100000000, 100000000])
735+
self.evaluate(tiled)
736+
726737

727738
if __name__ == "__main__":
728739
test.main()

0 commit comments

Comments
 (0)