Note: We can only import the output pointer if all of the following hold true: a) The imported pointer is aligned sufficiently b) The tensor has zero padding c) There is only one connection to the OutputSlot and it is to an OutputLayer. d) The output pointer is allocated via malloc. (Other types will be supported in a later release) e) m_IsExportEnabled must be set to true
| 1328 | // d) The output pointer is allocated via malloc. (Other types will be supported in a later release) |
| 1329 | // e) m_IsExportEnabled must be set to true |
| 1330 | void LoadedNetwork::ImportOutputTensor(const Tensor& outputTensor, ITensorHandle* outputTensorHandle) |
| 1331 | { |
| 1332 | if (!outputTensorHandle) |
| 1333 | { |
| 1334 | throw armnn::NullPointerException("Data should have been allocated."); |
| 1335 | } |
| 1336 | |
| 1337 | MemorySourceFlags importFlags = outputTensorHandle->GetImportFlags(); |
| 1338 | if (CheckFlag(importFlags, m_NetworkProperties.m_OutputSource)) |
| 1339 | { |
| 1340 | std::unique_ptr<ITensorHandle> tensorHandle = |
| 1341 | std::make_unique<PassthroughTensorHandle>(outputTensor.GetInfo(), |
| 1342 | outputTensor.GetMemoryArea()); |
| 1343 | |
| 1344 | void* mem = tensorHandle->Map(false); |
| 1345 | bool importOk = outputTensorHandle->Import(mem, m_NetworkProperties.m_OutputSource); |
| 1346 | tensorHandle->Unmap(); |
| 1347 | |
| 1348 | if (!importOk) |
| 1349 | { |
| 1350 | throw MemoryExportException("ImportOutputTensor: Memory Export failed"); |
| 1351 | } |
| 1352 | } |
| 1353 | else |
| 1354 | { |
| 1355 | throw MemoryExportException("ImportOutputTensor: Memory Export failed, attempting to export Input Layer"); |
| 1356 | } |
| 1357 | |
| 1358 | } |
| 1359 | |
| 1360 | void CopyToOutputTensor(const Tensor& outputTensor, ITensorHandle* outputTensorHandle) |
| 1361 | { |
nothing calls this directly
no test coverage detected