From fc884b4141a28fbd3c62f665341ec88158fcd332 Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Thu, 11 Jun 2020 17:35:44 +0100 Subject: Add support for Rank and scalar tensors !armnn:3330 Signed-off-by: Finn Williams Change-Id: Icc429d9fabb570193d12bffef0e00dda7b51032f --- Utils.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Utils.cpp') diff --git a/Utils.cpp b/Utils.cpp index 6481c287..d94a9377 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -200,6 +200,9 @@ armnn::TensorInfo GetTensorInfoForOperand(const V1_3::Operand& operand) case V1_3::OperandType::TENSOR_INT32: type = armnn::DataType::Signed32; break; + case V1_3::OperandType::INT32: + type = armnn::DataType::Signed32; + break; case V1_3::OperandType::TENSOR_QUANT8_ASYMM_SIGNED: type = armnn::DataType::QAsymmS8; break; @@ -207,7 +210,17 @@ armnn::TensorInfo GetTensorInfoForOperand(const V1_3::Operand& operand) throw UnsupportedOperand(operand.type); } - TensorInfo ret(operand.dimensions.size(), operand.dimensions.data(), type); + TensorInfo ret; + // 0 dimensional tensors will be flagged as scalars + if ( operand.dimensions.size() != 0) + { + ret = TensorInfo(operand.dimensions.size(), operand.dimensions.data(), type); + } + else + { + ret = TensorInfo(TensorShape(armnn::Dimensionality::Scalar), type); + } + if (perChannel) { // ExtraParams is expected to be of type channelQuant @@ -224,7 +237,6 @@ armnn::TensorInfo GetTensorInfoForOperand(const V1_3::Operand& operand) ret.SetQuantizationScale(operand.scale); ret.SetQuantizationOffset(operand.zeroPoint); } - return ret; } -- cgit v1.2.1