Commit e8ee5286 authored by Geoffrey Irving's avatar Geoffrey Irving Committed by TensorFlower Gardener
Browse files

Remove 2**40 size limit on TensorShape and harden to overflow

The limit was preventing valid uses of TensorShape as the dense shape of very
large sparse tensors.  There's no security advantage to the limit, since a
memory allocation of 2**40 bytes is already far beyond a reasonable machine
size.  The new limit is std::numeric_limits<int64>::max().

In addition, the previous TensorShape code did not check for overflow when
multiplying, which meant an operation as simple as

    tf.gather(tf.zeros([2**5, 2**60 + 1]), 7).eval()

would appear as valid during TensorShape construction and then crash.
A new MultiplyWithoutOverflow function does the correct overflow checking.

Fixes #8494.
Change: 151778176
parent 35e3f6c4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment