MCPcopy Create free account
hub / github.com/alibaba/MNN / _reshapeTensor

Function _reshapeTensor

express/module/StaticModule.cpp:232–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232static bool _reshapeTensor(Tensor* tensor, const Tensor* dims) {
233 bool dirty = false;
234 if (tensor->buffer().dimensions != dims->dimensions()) {
235 dirty = true;
236 } else {
237 for (int i = 0; i < dims->dimensions(); ++i) {
238 if (tensor->buffer().dim[i].extent != dims->length(i)) {
239 dirty = true;
240 break;
241 }
242 }
243 }
244 return dirty;
245}
246static bool _resizeTensor(Tensor* tensor, const Tensor* dims, Session* session, Schedule::TENSORCACHE* cacheTensor) {
247 MNN_ASSERT(nullptr != tensor);
248 bool dirty = _reshapeTensor(tensor, dims);

Callers 1

_resizeTensorFunction · 0.85

Calls 3

bufferMethod · 0.45
dimensionsMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected