TODO(b/62904716) Remove along with remaining uses.
| 638 | |
| 639 | // TODO(b/62904716) Remove along with remaining uses. |
| 640 | void UnextendShape(Shape* shape, int new_shape_size) { |
| 641 | CHECK_LE(new_shape_size, shape->dimensions_count()); |
| 642 | const int size_reduction = shape->dimensions_count() - new_shape_size; |
| 643 | for (int i = 0; i < size_reduction; i++) { |
| 644 | CHECK_EQ(shape->dims(i), 1); |
| 645 | } |
| 646 | std::vector<int>& shape_dims = *shape->mutable_dims(); |
| 647 | shape_dims.erase(shape_dims.begin(), shape_dims.begin() + size_reduction); |
| 648 | } |
| 649 | |
| 650 | // In general, zero-sized dimensions are disallowed, but there are exceptions, |
| 651 | // e.g., if the tensor data itself represents a scalar (rank 0) shape, its |
no test coverage detected