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 <sadik.armagan@arm.com>
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I62856deab24e106f72cccce09468db4971756fa6
diff --git a/Utils.hpp b/Utils.hpp
index 42fef3f..5aac471 100644
--- a/Utils.hpp
+++ b/Utils.hpp
@@ -4,7 +4,6 @@
//
#pragma once
-
#include <armnn/ArmNN.hpp>
#include <CpuExecutor.h>
@@ -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 <typename OperandType>
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 @@
/// 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 <typename HalModel>
std::string GetModelSummary(const HalModel& model)
{