| 362 | } |
| 363 | |
| 364 | Status TensorShapeOld::IsValidShape(const TensorShapeProto& proto) { |
| 365 | int64 num_elements = 1; |
| 366 | for (const auto& d : proto.dim()) { |
| 367 | if (d.size() < 0) { |
| 368 | return errors::InvalidArgument("Shape ", DebugString(proto), |
| 369 | " has negative dimensions; ", |
| 370 | "perhaps an un-fed placeholder?"); |
| 371 | } |
| 372 | num_elements *= d.size(); |
| 373 | if (num_elements > kMaxElements) { |
| 374 | return errors::InvalidArgument("Shape ", DebugString(proto), |
| 375 | " is too large (more than ", kMaxElements, |
| 376 | " entries)"); |
| 377 | } |
| 378 | } |
| 379 | return Status::OK(); |
| 380 | } |
| 381 | |
| 382 | TensorShapeOld::TensorShapeOld(const TensorShapeProto& proto) { |
| 383 | dim_sizes_.reserve(proto.dim_size()); |
nothing calls this directly
no test coverage detected