aboutsummaryrefslogtreecommitdiff
path: root/ModelToINetworkConverter.cpp
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2019-06-11 16:35:25 +0100
committerMike Kelly <mike.kelly@arm.com>2019-06-11 16:35:25 +0100
commitb5fdf38f0c6596958fab2b84882f2792a31e585a (patch)
treed6b578b51c1923c759653d8a04efa90923ad4dd8 /ModelToINetworkConverter.cpp
parentb92f8901fc34749337ea7a9ad7a2717fc9490de5 (diff)
downloadandroid-nn-driver-b5fdf38f0c6596958fab2b84882f2792a31e585a.tar.gz
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
Diffstat (limited to 'ModelToINetworkConverter.cpp')
-rw-r--r--ModelToINetworkConverter.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/ModelToINetworkConverter.cpp b/ModelToINetworkConverter.cpp
index 2a79a279..96a65604 100644
--- a/ModelToINetworkConverter.cpp
+++ b/ModelToINetworkConverter.cpp
@@ -37,6 +37,8 @@ template<typename HalPolicy>
void ModelToINetworkConverter<HalPolicy>::Convert()
{
using HalModel = typename HalPolicy::Model;
+ using Operand = typename HalPolicy::Operand;
+ using OperandType = typename HalPolicy::OperationType;
ALOGV("ModelToINetworkConverter::Convert(): %s", GetModelSummary<HalModel>(m_Model).c_str());
@@ -68,7 +70,7 @@ void ModelToINetworkConverter<HalPolicy>::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<HalPolicy>::Convert()
m_Data.m_OutputSlotForOperand[inputIndex] = &outputSlot;
}
}
- catch (UnsupportedOperand& e)
+ catch (UnsupportedOperand<OperandType>& 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<HalPolicy>::Convert()
{
ok = HalPolicy::ConvertOperation(operation, m_Model, m_Data);
}
- catch (UnsupportedOperand& e)
+ catch (UnsupportedOperand<OperandType>& 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<HalPolicy>::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<hal_1_0::HalPolicy>;
template class ModelToINetworkConverter<hal_1_1::HalPolicy>;
#endif
+#ifdef ARMNN_ANDROID_NN_V1_2
+template class ModelToINetworkConverter<hal_1_1::HalPolicy>;
+template class ModelToINetworkConverter<hal_1_2::HalPolicy>;
+#endif
+
} // armnn_driver