From b5fdf38f0c6596958fab2b84882f2792a31e585a Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Tue, 11 Jun 2019 16:35:25 +0100 Subject: IVGCVSW-3181 Add HAL 1.2 support to android-nn-driver * Updated Android.mk to build HAL 1.2 driver * Added 1.2 HalPolicy and ArmnnDriver * Added 1.2 ArmnnPreparedModel * Updated converters and utilities to accept new HAL 1.2 operands and operand types. Signed-off-by: Sadik Armagan Signed-off-by: Mike Kelly Change-Id: I62856deab24e106f72cccce09468db4971756fa6 --- Utils.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Utils.hpp') diff --git a/Utils.hpp b/Utils.hpp index 42fef3fb..5aac4716 100644 --- a/Utils.hpp +++ b/Utils.hpp @@ -4,7 +4,6 @@ // #pragma once - #include #include @@ -21,20 +20,25 @@ namespace V1_0 = ::android::hardware::neuralnetworks::V1_0; +#ifdef ARMNN_ANDROID_NN_V1_2 // Using ::android::hardware::neuralnetworks::V1_2 +namespace V1_2 = ::android::hardware::neuralnetworks::V1_2; +#endif + namespace armnn_driver { extern const armnn::PermutationVector g_DontPermute; +template class UnsupportedOperand: public std::runtime_error { public: - UnsupportedOperand(const V1_0::OperandType type) + UnsupportedOperand(const OperandType type) : std::runtime_error("Operand type is unsupported") , m_type(type) {} - V1_0::OperandType m_type; + OperandType m_type; }; /// Swizzles tensor data in @a input according to the dimension mappings. @@ -48,8 +52,16 @@ void* GetMemoryFromPool(DataLocation location, /// Can throw UnsupportedOperand armnn::TensorInfo GetTensorInfoForOperand(const V1_0::Operand& operand); +#ifdef ARMNN_ANDROID_NN_V1_2 // Using ::android::hardware::neuralnetworks::V1_2 +armnn::TensorInfo GetTensorInfoForOperand(const V1_2::Operand& operand); +#endif + std::string GetOperandSummary(const V1_0::Operand& operand); +#ifdef ARMNN_ANDROID_NN_V1_2 // Using ::android::hardware::neuralnetworks::V1_2 +std::string GetOperandSummary(const V1_2::Operand& operand); +#endif + template std::string GetModelSummary(const HalModel& model) { -- cgit v1.2.1