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

Method copyFromHostTensor

source/core/Tensor.cpp:171–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171bool Tensor::copyFromHostTensor(const Tensor* hostTensor) {
172 auto bn = mDescribe->getBackend();
173 if (nullptr == bn) {
174 return false;
175 }
176 auto hostbn = hostTensor->mDescribe->getBackend();
177 std::shared_ptr<Tensor> tmpTensor;
178 if (nullptr != hostbn && hostbn->type() != bn->type() && hostbn->type() != MNN_FORWARD_CPU) {
179 tmpTensor.reset(new Tensor(hostTensor, hostTensor->getDimensionType()));
180 hostTensor->copyToHostTensor(tmpTensor.get());
181 hostTensor = tmpTensor.get();
182 }
183 bn->onCopyBuffer(hostTensor, this);
184 return true;
185}
186
187bool Tensor::copyToHostTensor(Tensor* hostTensor) const {
188 auto bn = mDescribe->getBackend();

Callers 15

mainFunction · 0.80
compareNetFunction · 0.80
mainFunction · 0.80
_loadInputFromFileFunction · 0.80
test_mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
_zeroInputsFunction · 0.80
compareForwadTypeFunction · 0.80
runMNNModelFunction · 0.80
runNetFunction · 0.80
convertMethod · 0.80

Calls 7

getDimensionTypeMethod · 0.80
copyToHostTensorMethod · 0.80
getBackendMethod · 0.45
typeMethod · 0.45
resetMethod · 0.45
getMethod · 0.45
onCopyBufferMethod · 0.45

Tested by 13

mainFunction · 0.64
mainFunction · 0.64
test_mainFunction · 0.64
mainFunction · 0.64
_zeroInputsFunction · 0.64
compareForwadTypeFunction · 0.64
runMNNModelFunction · 0.64
_runMethod · 0.64
runMethod · 0.64
inputMethod · 0.64
runMethod · 0.64
inputMethod · 0.64