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.hpp | |
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.hpp')
-rw-r--r-- | Utils.hpp | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -150,18 +150,24 @@ inline V1_2::OutputShape ComputeShape(const armnn::TensorInfo& info) { V1_2::OutputShape shape; - android::hardware::hidl_vec<uint32_t> dimensions; - armnn::TensorShape tensorShape = info.GetShape(); - const unsigned int numDims = tensorShape.GetNumDimensions(); - dimensions.resize(numDims); - - for (unsigned int outputIdx = 0u; outputIdx < numDims; ++outputIdx) + // Android will expect scalars as a zero dimensional tensor + if(tensorShape.GetDimensionality() == armnn::Dimensionality::Scalar) + { + shape.dimensions = android::hardware::hidl_vec<uint32_t>{}; + } + else { - dimensions[outputIdx] = tensorShape[outputIdx]; + android::hardware::hidl_vec<uint32_t> dimensions; + const unsigned int numDims = tensorShape.GetNumDimensions(); + dimensions.resize(numDims); + for (unsigned int outputIdx = 0u; outputIdx < numDims; ++outputIdx) + { + dimensions[outputIdx] = tensorShape[outputIdx]; + } + shape.dimensions = dimensions; } - shape.dimensions = dimensions; shape.isSufficient = true; return shape; |