diff options
author | Finn Williams <Finn.Williams@Arm.com> | 2020-06-11 17:35:44 +0100 |
---|---|---|
committer | Finn Williams <Finn.Williams@Arm.com> | 2020-07-06 19:07:52 +0100 |
commit | fc884b4141a28fbd3c62f665341ec88158fcd332 (patch) | |
tree | df18555baced3f4d917a78d24d87c5e2d1778f83 /Utils.cpp | |
parent | 00b586b1f3106a4e6970ca7feacb1cc1892d107e (diff) | |
download | android-nn-driver-fc884b4141a28fbd3c62f665341ec88158fcd332.tar.gz |
Add support for Rank and scalar tensors
!armnn:3330
Signed-off-by: Finn Williams <Finn.Williams@Arm.com>
Change-Id: Icc429d9fabb570193d12bffef0e00dda7b51032f
Diffstat (limited to 'Utils.cpp')
-rw-r--r-- | Utils.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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<V1_3::OperandType>(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; } |