IVGCVSW-3477 Refactor android-nn-driver to use armnn ILayerSupported
!armnn:1508
Signed-off-by: Ferran Balaguer <ferran.balaguer@arm.com>
Change-Id: Ica5fcb683f101bde9e651f0be0f5b9b4c409d1aa
diff --git a/1.1/HalPolicy.cpp b/1.1/HalPolicy.cpp
index fbd2e08..d7f4bbb 100644
--- a/1.1/HalPolicy.cpp
+++ b/1.1/HalPolicy.cpp
@@ -129,12 +129,15 @@
const armnn::TensorInfo& outInfo = GetTensorInfoForOperand(*outputOperand);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsDivisionSupported,
- data.m_Backends,
- input0.GetTensorInfo(),
- input1.GetTensorInfo(),
- outInfo))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsDivisionSupported,
+ data.m_Backends,
+ isSupported,
+ input0.GetTensorInfo(),
+ input1.GetTensorInfo(),
+ outInfo);
+ if (!isSupported)
{
return false;
}
@@ -185,12 +188,15 @@
outputInfo.SetShape(InferSubOutputShape(input0.GetTensorInfo().GetShape(), input1.GetTensorInfo().GetShape()));
}
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsSubtractionSupported,
- data.m_Backends,
- input0.GetTensorInfo(),
- input1.GetTensorInfo(),
- outputInfo))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsSubtractionSupported,
+ data.m_Backends,
+ isSupported,
+ input0.GetTensorInfo(),
+ input1.GetTensorInfo(),
+ outputInfo);
+ if (!isSupported)
{
return false;
}
@@ -263,12 +269,15 @@
const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsMeanSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- descriptor))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsMeanSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ descriptor);
+ if (!isSupported)
{
return false;
}
@@ -310,12 +319,15 @@
outputInfo.SetShape(InferPadOutputShape(inputInfo.GetShape(), descriptor.m_PadList));
}
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsPadSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- descriptor))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsPadSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ descriptor);
+ if (!isSupported)
{
return false;
}
@@ -400,12 +412,16 @@
}
const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsSpaceToBatchNdSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- descriptor))
+
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsSpaceToBatchNdSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ descriptor);
+ if (!isSupported)
{
return false;
}
@@ -477,11 +493,14 @@
return Fail("%s: Could not read output 0", __func__);
}
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsReshapeSupported,
- data.m_Backends,
- inputInfo,
- reshapeDesc))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsReshapeSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ reshapeDesc);
+ if (!isSupported)
{
return false;
}
@@ -566,12 +585,15 @@
}
const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsStridedSliceSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- descriptor))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsStridedSliceSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ descriptor);
+ if (!isSupported)
{
return false;
}
@@ -639,12 +661,15 @@
const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsPermuteSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- permuteDesc))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsPermuteSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ permuteDesc);
+ if (!isSupported)
{
return false;
}
@@ -706,12 +731,15 @@
const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output);
- if (!IsLayerSupportedForAnyBackend(__func__,
- armnn::IsBatchToSpaceNdSupported,
- data.m_Backends,
- inputInfo,
- outputInfo,
- batchToSpaceNdDesc))
+ bool isSupported = false;
+ FORWARD_LAYER_SUPPORT_FUNC(__func__,
+ IsBatchToSpaceNdSupported,
+ data.m_Backends,
+ isSupported,
+ inputInfo,
+ outputInfo,
+ batchToSpaceNdDesc);
+ if (!isSupported)
{
return false;
}
@@ -724,4 +752,4 @@
}
} // namespace hal_1_1
-} // namespace armnn_driver
\ No newline at end of file
+} // namespace armnn_driver