aboutsummaryrefslogtreecommitdiff
path: root/ConversionUtils.hpp
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2019-03-14 11:56:32 +0000
committerÁron Virginás-Tar <aron.virginas-tar@arm.com>2019-03-15 10:56:29 +0000
commitf29a2c55af463141fac7c92042bfdb9f00ba4ccd (patch)
tree675816444109edc6af2268d407e6e61971485841 /ConversionUtils.hpp
parent7bac1d7e8a7bf82d7c481cf05e31ae76f91725a6 (diff)
downloadandroid-nn-driver-f29a2c55af463141fac7c92042bfdb9f00ba4ccd.tar.gz
MLCE-91 LSTM doesn't support optional input
* Add fix for optional NO_VALUE operands in ConversionUtils.hpp * Remove fail message for optional NO_VALUE in ConversionUtils.hpp * Add to existing tests and test helper to cover optional NO_VALUE Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: Icf36af1fc00d3fb33cdd77ff6d6618cc4700d3fd
Diffstat (limited to 'ConversionUtils.hpp')
-rw-r--r--ConversionUtils.hpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/ConversionUtils.hpp b/ConversionUtils.hpp
index c86ad93c..ca1f0aea 100644
--- a/ConversionUtils.hpp
+++ b/ConversionUtils.hpp
@@ -488,13 +488,16 @@ ConstTensorPin ConvertOperandToConstTensorPin(const Operand& operand,
return ConstTensorPin();
}
- if (operand.lifetime != OperandLifeTime::CONSTANT_COPY && operand.lifetime != OperandLifeTime::CONSTANT_REFERENCE)
+ if (!optional &&
+ operand.lifetime != OperandLifeTime::CONSTANT_COPY &&
+ operand.lifetime != OperandLifeTime::CONSTANT_REFERENCE &&
+ operand.lifetime != OperandLifeTime::NO_VALUE)
{
Fail("%s: invalid operand lifetime: %s", __func__, toString(operand.lifetime).c_str());
return ConstTensorPin();
}
- const void* const valueStart = GetOperandValueReadOnlyAddress(operand, model, data);
+ const void* const valueStart = GetOperandValueReadOnlyAddress(operand, model, data, optional);
if (!valueStart)
{
if (optional)
@@ -539,7 +542,8 @@ ConstTensorPin ConvertOperationInputToConstTensorPin(const HalOperation& operati
}
template<typename HalModel>
-const void* GetOperandValueReadOnlyAddress(const Operand& operand, const HalModel& model, const ConversionData& data)
+const void* GetOperandValueReadOnlyAddress(const Operand& operand, const HalModel& model, const ConversionData& data,
+ bool optional = false)
{
const void* valueStart = nullptr;
@@ -557,6 +561,15 @@ const void* GetOperandValueReadOnlyAddress(const Operand& operand, const HalMode
valueStart = GetMemoryFromPool(operand.location, data.m_MemPools);
break;
}
+ case OperandLifeTime::NO_VALUE:
+ {
+ // An optional input tensor with no values is not an error so should not register as a fail
+ if (optional)
+ {
+ valueStart = nullptr;
+ break;
+ }
+ }
default:
{
// Unsupported/invalid (e.g. can't get value of an input to the model)