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

Method usize

source/core/Tensor.cpp:409–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409size_t Tensor::usize() const {
410 size_t dataSize = mBuffer.type.bytes();
411 MNN_ASSERT(dataSize >= 1);
412 auto nativeDescribe = mDescribe->mContent.get();
413 for (int i = 0; i < this->buffer().dimensions; i++) {
414 int currentDimSize = mBuffer.dim[i].extent;
415 if (nativeDescribe->dimensionFormat == MNN_DATA_FORMAT_NC4HW4 && 1 == i) {
416 currentDimSize = ALIGN_UP4(currentDimSize);
417 }
418 dataSize *= currentDimSize;
419 }
420 return dataSize;
421}
422
423int Tensor::size() const {
424 return static_cast<int>(usize());

Callers 15

set1x1WeightLowMemoryMethod · 0.80
set1x1WeightLowMemoryMethod · 0.80
onExecuteMethod · 0.80
dft_bluestein_z_chirpFunction · 0.80
onExecuteMethod · 0.80
_copyBufferToTensorFunction · 0.80
_copyTensorToBufferFunction · 0.80
allocMethod · 0.80
setupAddressMethod · 0.80

Calls 3

bytesMethod · 0.45
getMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected