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

Method unmap

source/core/Tensor.cpp:463–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463void Tensor::unmap(MapType mtype, DimensionType dtype, void *mapPtr) {
464 auto nativeDescribe = mDescribe;
465 auto bn = nativeDescribe->getBackend();
466 if (nullptr == bn) {
467 return;
468 }
469
470 bool ret = bn->onUnmapTensor(mtype, dtype, this, mapPtr);
471 if(true == ret) {
472 //do unmap already, just return
473 return;
474 }
475
476 if(mtype == Tensor::MAP_TENSOR_WRITE) {
477 //srcTensor alloc
478 MNN::Tensor srcTensor(this, dtype, false);
479 srcTensor.buffer().host = (uint8_t *)mapPtr;
480
481 //use onCopyBuffer
482 bn->onCopyBuffer(&srcTensor, this);
483 }
484 if(mapPtr != nullptr) {
485 free(mapPtr);
486 mapPtr = nullptr;
487 }
488}
489int Tensor::wait(MapType mtype, bool finish) {
490 auto nativeDescribe = mDescribe;
491 auto bn = nativeDescribe->getBackend();

Callers 5

test_mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
doBenchFunction · 0.45
createHostPlanarFunction · 0.45

Calls 4

getBackendMethod · 0.45
onUnmapTensorMethod · 0.45
bufferMethod · 0.45
onCopyBufferMethod · 0.45

Tested by 3

test_mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36