MCPcopy Create free account
hub / github.com/ARM-software/armnn / ImportOutputTensor

Method ImportOutputTensor

src/armnn/LoadedNetwork.cpp:1330–1358  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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
1330void 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
1360void CopyToOutputTensor(const Tensor& outputTensor, ITensorHandle* outputTensorHandle)
1361{

Callers

nothing calls this directly

Calls 8

CheckFlagFunction · 0.85
GetMemoryAreaMethod · 0.80
GetImportFlagsMethod · 0.45
MapMethod · 0.45
ImportMethod · 0.45
UnmapMethod · 0.45

Tested by

no test coverage detected