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
Loading
Please sign in to comment