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 --- ModelToINetworkConverter.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'ModelToINetworkConverter.cpp') diff --git a/ModelToINetworkConverter.cpp b/ModelToINetworkConverter.cpp index 2a79a279..96a65604 100644 --- a/ModelToINetworkConverter.cpp +++ b/ModelToINetworkConverter.cpp @@ -37,6 +37,8 @@ template void ModelToINetworkConverter::Convert() { using HalModel = typename HalPolicy::Model; + using Operand = typename HalPolicy::Operand; + using OperandType = typename HalPolicy::OperationType; ALOGV("ModelToINetworkConverter::Convert(): %s", GetModelSummary(m_Model).c_str()); @@ -68,7 +70,7 @@ void ModelToINetworkConverter::Convert() { // inputs in android nn are represented by operands uint32_t inputIndex = m_Model.inputIndexes[i]; - const V1_0::Operand& operand = m_Model.operands[inputIndex]; + const Operand& operand = m_Model.operands[inputIndex]; const armnn::TensorInfo& tensor = GetTensorInfoForOperand(operand); armnn::IConnectableLayer* layer = m_Data.m_Network->AddInputLayer(i); @@ -79,7 +81,7 @@ void ModelToINetworkConverter::Convert() m_Data.m_OutputSlotForOperand[inputIndex] = &outputSlot; } } - catch (UnsupportedOperand& e) + catch (UnsupportedOperand& e) { Fail("%s: Operand type %s not supported in ArmnnDriver", __func__, toString(e.m_type).c_str()); m_ConversionResult = ConversionResult::UnsupportedFeature; @@ -107,7 +109,7 @@ void ModelToINetworkConverter::Convert() { ok = HalPolicy::ConvertOperation(operation, m_Model, m_Data); } - catch (UnsupportedOperand& e) + catch (UnsupportedOperand& e) { Fail("%s: Operand type %s not supported in ArmnnDriver", __func__, toString(e.m_type).c_str()); ok = false; @@ -137,7 +139,7 @@ void ModelToINetworkConverter::Convert() { // outputs in android nn are represented by operands uint32_t outputIndex = m_Model.outputIndexes[i]; - const V1_0::Operand& operand = m_Model.operands[outputIndex]; + const Operand& operand = m_Model.operands[outputIndex]; const armnn::TensorInfo& tensor = GetTensorInfoForOperand(operand); armnn::IConnectableLayer* layer = m_Data.m_Network->AddOutputLayer(i); @@ -171,4 +173,9 @@ template class ModelToINetworkConverter; template class ModelToINetworkConverter; #endif +#ifdef ARMNN_ANDROID_NN_V1_2 +template class ModelToINetworkConverter; +template class ModelToINetworkConverter; +#endif + } // armnn_driver -- cgit v1.2.1