From e27d4e89a34b07628b9a3de89706ca2558e9ee8e Mon Sep 17 00:00:00 2001 From: Cathal Corbett Date: Thu, 28 Oct 2021 12:28:35 +0100 Subject: 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 Change-Id: Iee179586652f365665a22f1e3409c1488c2d8bb3 --- ArmnnPreparedModel_1_2.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ArmnnPreparedModel_1_2.cpp') 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 ArmnnPreparedModel_1_2::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::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()); -- cgit v1.2.1