MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / UnextendShape

Function UnextendShape

tensorflow/lite/toco/tooling_util.cc:640–648  ·  view source on GitHub ↗

TODO(b/62904716) Remove along with remaining uses.

Source from the content-addressed store, hash-verified

638
639// TODO(b/62904716) Remove along with remaining uses.
640void 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

Callers 5

ConvertConvOperatorFunction · 0.85
ConvertLstmCellOperatorFunction · 0.85
ReorderAxesFunction · 0.85

Calls 5

dimensions_countMethod · 0.80
mutable_dimsMethod · 0.80
dimsMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected