| 352 | static const int64 kMaxElements = (1LL << 40); |
| 353 | |
| 354 | bool TensorShapeOld::IsValid(const TensorShapeProto& proto) { |
| 355 | int64 num_elements = 1; |
| 356 | for (const auto& d : proto.dim()) { |
| 357 | if (d.size() < 0) return false; |
| 358 | num_elements *= d.size(); |
| 359 | if (num_elements > kMaxElements) return false; |
| 360 | } |
| 361 | return true; |
| 362 | } |
| 363 | |
| 364 | Status TensorShapeOld::IsValidShape(const TensorShapeProto& proto) { |
| 365 | int64 num_elements = 1; |