aboutsummaryrefslogtreecommitdiff
path: root/shim/sl/canonical/ConversionUtils.cpp
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2023-08-23 10:07:26 +0100
committerKevin May <kevin.may@arm.com>2023-08-23 15:56:16 +0100
commit7fbf8109a972f0508f82ea40acc103b5959d115b (patch)
tree3e5e49082b2d33e102be1ef2d6e7492e5a7d7140 /shim/sl/canonical/ConversionUtils.cpp
parent5f94124ac11afbbf2d2a4cda539b316964802c76 (diff)
downloadarmnn-7fbf8109a972f0508f82ea40acc103b5959d115b.tar.gz
IVGCVSW-7957 Fix weights checking when converting in Support Library
* An Operand can only have NO_VALUE if it is an optional argument of an operation * Add a check to see if the operand is optional to IsWeightsValid Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: Ib22cb7e60f6121d64f8a3bf6cb8c3d13930aa315
Diffstat (limited to 'shim/sl/canonical/ConversionUtils.cpp')
-rw-r--r--shim/sl/canonical/ConversionUtils.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/shim/sl/canonical/ConversionUtils.cpp b/shim/sl/canonical/ConversionUtils.cpp
index b64854856e..8c31a92ff2 100644
--- a/shim/sl/canonical/ConversionUtils.cpp
+++ b/shim/sl/canonical/ConversionUtils.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -133,7 +133,8 @@ const armnn::ConstTensor* ConstTensorPin::GetConstTensorPtr() const
bool IsWeightsValid(const Operation& operation,
uint32_t inputIndex,
- const Model& model)
+ const Model& model,
+ const bool isOptional = true)
{
const Operand* operand = GetInputOperand(operation, inputIndex, model);
if (!operand)
@@ -141,7 +142,11 @@ bool IsWeightsValid(const Operation& operation,
Fail("%s: failed to get input operand %i", __func__, inputIndex);
return false;
}
-
+ // If the operand is not an optional operand it cannot have a NO_VALUE lifetime
+ if (!isOptional && operand->lifetime == OperandLifeTime::NO_VALUE)
+ {
+ return false;
+ }
if (operand->lifetime != OperandLifeTime::CONSTANT_COPY
&& operand->lifetime != OperandLifeTime::CONSTANT_REFERENCE
&& operand->lifetime != OperandLifeTime::NO_VALUE)