Update tensor_shape.cc
This commit is contained in:
parent
49cf3e2341
commit
c799bd996e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user