IVGCVSW-6954 'Arm NN Support Library Implementation'
* Fixed model converting issue
* Fixed import memory issue
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: Ied61810b308e0c5d5754f122a6ea2bac1d0725f1
diff --git a/shim/sl/canonical/ArmnnPreparedModel.cpp b/shim/sl/canonical/ArmnnPreparedModel.cpp
index 54a0190..79cd241 100644
--- a/shim/sl/canonical/ArmnnPreparedModel.cpp
+++ b/shim/sl/canonical/ArmnnPreparedModel.cpp
@@ -393,7 +393,37 @@
armnn::Status status;
VLOG(DRIVER) << "ArmnnPreparedModel::ExecuteGraph m_AsyncModelExecutionEnabled false";
importedInputIds = m_Runtime->ImportInputs(m_NetworkId, inputTensors, armnn::MemorySource::Malloc);
+ if (!importedInputIds.empty())
+ {
+ // Some or all of the input tensors been imported. We need to remove the ones that could from
+ // inputTensors.
+ for (armnn::ImportedInputId& importedId : importedInputIds)
+ {
+ inputTensors.erase(
+ std::remove_if(
+ inputTensors.begin(), inputTensors.end(),
+ [&importedId](std::pair<armnn::LayerBindingId, class armnn::ConstTensor>& element) {
+ return (element.first == static_cast<int>(importedId));
+ }),
+ inputTensors.end());
+ }
+ }
importedOutputIds = m_Runtime->ImportOutputs(m_NetworkId, outputTensors, armnn::MemorySource::Malloc);
+ if (!importedOutputIds.empty())
+ {
+ // Some or all of the output tensors could not be imported. We need to remove the ones that could
+ // from outputTensors.
+ for (armnn::ImportedInputId& importedId : importedOutputIds)
+ {
+ outputTensors.erase(
+ std::remove_if(
+ outputTensors.begin(), outputTensors.end(),
+ [&importedId](std::pair<armnn::LayerBindingId, class armnn::Tensor>& element) {
+ return (element.first == static_cast<int>(importedId));
+ }),
+ outputTensors.end());
+ }
+ }
status = m_Runtime->EnqueueWorkload(m_NetworkId,
inputTensors,
outputTensors,