diff options
author | Cathal Corbett <cathal.corbett@arm.com> | 2024-06-12 09:15:02 +0100 |
---|---|---|
committer | Cathal Corbett <cathal.corbett@arm.com> | 2024-06-12 16:20:10 +0000 |
commit | 1cb68e63da15c707126dbd71775f52cecd86b963 (patch) | |
tree | 3f2de07a8b70fbfa903ff358c12cb51c22c7046a /delegate | |
parent | f404b174b53cd9fb5eec20de79825137e22362af (diff) | |
download | armnn-1cb68e63da15c707126dbd71775f52cecd86b963.tar.gz |
IVGCVSW-8289 Add Numpy Support to execute network
* Creates a numpy parser helper header
* Adds ability to parse numpy file in PopulateTensorWithData
* Reuse ExNet compare-output flag to compare against npy golden files.
* Reuse ExNet write-outputs-to-file flag to write output to npy file.
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: I52df822f72f6ce9d191ac4bd26ca5718ccaa7a4a
Diffstat (limited to 'delegate')
-rw-r--r-- | delegate/classic/src/ClassicDelegateUtils.hpp | 46 | ||||
-rw-r--r-- | delegate/common/src/DelegateUtils.hpp | 46 |
2 files changed, 46 insertions, 46 deletions
diff --git a/delegate/classic/src/ClassicDelegateUtils.hpp b/delegate/classic/src/ClassicDelegateUtils.hpp index f5ff32a3df..78eb662d7b 100644 --- a/delegate/classic/src/ClassicDelegateUtils.hpp +++ b/delegate/classic/src/ClassicDelegateUtils.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2023 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2023-2024 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -359,50 +359,6 @@ armnn::IConnectableLayer* AddReshapeLayer(TfLiteContext* tfLiteContext, return reshapeLayer; } -armnn::DataType GetDataType(const TfLiteTensor& tfLiteTensor) -{ - switch (tfLiteTensor.type) - { - case kTfLiteBool: - return armnn::DataType::Boolean; - case kTfLiteFloat32: - return armnn::DataType::Float32; - case kTfLiteFloat16: - return armnn::DataType::Float16; - case kTfLiteUInt8: - return armnn::DataType::QAsymmU8; - case kTfLiteInt8: - { - auto quantizationInfo = tfLiteTensor.quantization; - if (quantizationInfo.type == kTfLiteAffineQuantization) - { - auto* quantization = - reinterpret_cast<TfLiteAffineQuantization*>(tfLiteTensor.quantization.params); - if (quantization->zero_point != nullptr && quantization->zero_point->size == 1) - { - return armnn::DataType::QAsymmS8; - } - else - { - return armnn::DataType::QSymmS8; - } - } - else - { - return armnn::DataType::QAsymmS8; - } - } - case kTfLiteInt16: - return armnn::DataType::QSymmS16; - case kTfLiteInt32: - return armnn::DataType::Signed32; - case kTfLiteInt64: - return armnn::DataType::Signed64; - default: - throw armnn::Exception(&"TfLiteArmnnDelegate: Unsupported data type: " [ tfLiteTensor.type]); - } -} - armnn::TensorInfo GetTensorInfoForTfLiteTensor(const TfLiteTensor& tfLiteTensor, bool isOutput = false) { armnn::DataType type = GetDataType(tfLiteTensor); diff --git a/delegate/common/src/DelegateUtils.hpp b/delegate/common/src/DelegateUtils.hpp index a2cdc83a64..96767ff78c 100644 --- a/delegate/common/src/DelegateUtils.hpp +++ b/delegate/common/src/DelegateUtils.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2020-2024 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -26,6 +26,50 @@ namespace { +armnn::DataType GetDataType(const TfLiteTensor& tfLiteTensor) +{ + switch (tfLiteTensor.type) + { + case kTfLiteBool: + return armnn::DataType::Boolean; + case kTfLiteFloat32: + return armnn::DataType::Float32; + case kTfLiteFloat16: + return armnn::DataType::Float16; + case kTfLiteUInt8: + return armnn::DataType::QAsymmU8; + case kTfLiteInt8: + { + auto quantizationInfo = tfLiteTensor.quantization; + if (quantizationInfo.type == kTfLiteAffineQuantization) + { + auto* quantization = + reinterpret_cast<TfLiteAffineQuantization*>(tfLiteTensor.quantization.params); + if (quantization->zero_point != nullptr && quantization->zero_point->size == 1) + { + return armnn::DataType::QAsymmS8; + } + else + { + return armnn::DataType::QSymmS8; + } + } + else + { + return armnn::DataType::QAsymmS8; + } + } + case kTfLiteInt16: + return armnn::DataType::QSymmS16; + case kTfLiteInt32: + return armnn::DataType::Signed32; + case kTfLiteInt64: + return armnn::DataType::Signed64; + default: + throw armnn::Exception(&"TfLiteArmnnDelegate: Unsupported data type: " [ tfLiteTensor.type]); + } +} + uint32_t NonNegative(int32_t value, int nodeIndex) { if (value < 0) |