Update tensor_shape.cc

This commit is contained in:
tg-at-google 2020-06-05 08:56:29 -04:00 committed by GitHub
parent 49cf3e2341
commit c799bd996e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,12 +182,12 @@ void TensorShapeBase<Shape>::InitDims(gtl::ArraySlice<int64> dim_sizes) {
// Allow sizes that are under kint64max^0.25 so that 4-way multiplication
// below cannot overflow.
static const uint64 kMaxSmall = 0xd744;
static const int64 kMaxSmall = 0xd744;
static_assert(kMaxSmall * kMaxSmall * kMaxSmall * kMaxSmall <= kint64max,
"bad overflow check");
bool large_size = false;
for (auto s : dim_sizes) {
if (static_cast<size_t>(s) > static_cast<size_t>(kMaxSmall)) {
if (s > kMaxSmall) {
large_size = true;
break;
}