aboutsummaryrefslogtreecommitdiff
path: root/ArmnnPreparedModel_1_2.cpp
diff options
context:
space:
mode:
authorCathal Corbett <cathal.corbett@arm.com>2021-10-28 12:28:35 +0100
committerFrancis Murtagh <francis.murtagh@arm.com>2021-11-04 17:06:47 +0000
commite27d4e89a34b07628b9a3de89706ca2558e9ee8e (patch)
tree5b990d846b19296bedf71a7ace440120f371d815 /ArmnnPreparedModel_1_2.cpp
parent0a2dfabd76a45c58d0a14567f0503369c4e6fbf3 (diff)
downloadandroid-nn-driver-e27d4e89a34b07628b9a3de89706ca2558e9ee8e.tar.gz
IVGCVSW-6420: Constant flag in tensor info is not set correctly
!armnn:6495 * Made fixes to 3 files ArmnnPreparedModel(_1_2/_1_3).cpp to set TensorInfo to constant in PrepareMemoryForInputs(). * Fixes made due to cts and vts failures in https://review.mlplatform.org/c/ml/armnn/+/6495 when a Tensor is passed to a ConstTensor without the TensorInfo isConstant parameter being set. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: Iee179586652f365665a22f1e3409c1488c2d8bb3
Diffstat (limited to 'ArmnnPreparedModel_1_2.cpp')
-rw-r--r--ArmnnPreparedModel_1_2.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/ArmnnPreparedModel_1_2.cpp b/ArmnnPreparedModel_1_2.cpp
index 7cc75473..f3d05ef5 100644
--- a/ArmnnPreparedModel_1_2.cpp
+++ b/ArmnnPreparedModel_1_2.cpp
@@ -299,7 +299,10 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForIn
{
const auto& inputArg = request.inputs[i];
- const armnn::TensorInfo inputTensorInfo = m_Runtime->GetInputTensorInfo(m_NetworkId, i);
+ armnn::TensorInfo inputTensorInfo = m_Runtime->GetInputTensorInfo(m_NetworkId, i);
+ // inputs (of type InputTensors) is composed of a vector of ConstTensors.
+ // Therefore, set all TensorInfo isConstant parameters of input Tensors to true.
+ inputTensorInfo.SetConstant();
const armnn::Tensor inputTensor = GetTensorForRequestArgument(inputArg, inputTensorInfo, memPools);
if (inputTensor.GetMemoryArea() == nullptr)
@@ -580,7 +583,11 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteWithDummyInputs(unsigned int num
armnn::InputTensors inputTensors;
for (unsigned int i = 0; i < numInputs; i++)
{
- const armnn::TensorInfo inputTensorInfo = m_Runtime->GetInputTensorInfo(m_NetworkId, i);
+ armnn::TensorInfo inputTensorInfo = m_Runtime->GetInputTensorInfo(m_NetworkId, i);
+ // pInputTensors (of type InputTensors) is composed of a vector of ConstTensors.
+ // Therefore, set all TensorInfo isConstant parameters of input Tensors to true.
+ inputTensorInfo.SetConstant();
+
storage.emplace_back(inputTensorInfo.GetNumBytes());
const armnn::ConstTensor inputTensor(inputTensorInfo, storage.back().data());