From d30093c755b7e4e354eb537272876ec95b0eddc9 Mon Sep 17 00:00:00 2001 From: Ferran Balaguer Date: Tue, 9 Jul 2019 17:04:47 +0100 Subject: IVGCVSW-3477 Refactor android-nn-driver to use armnn ILayerSupported !armnn:1508 Signed-off-by: Ferran Balaguer Change-Id: Ica5fcb683f101bde9e651f0be0f5b9b4c409d1aa --- 1.2/HalPolicy.cpp | 99 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 40 deletions(-) (limited to '1.2/HalPolicy.cpp') diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp index 9ccac9b4..4cac12ad 100644 --- a/1.2/HalPolicy.cpp +++ b/1.2/HalPolicy.cpp @@ -272,14 +272,17 @@ bool HalPolicy::ConvertConv2d(const Operation& operation, const Model& model, Co desc.m_BiasEnabled = true; armnn::Optional biases(bias.GetInfo()); - if (!IsLayerSupportedForAnyBackend(__func__, - armnn::IsConvolution2dSupported, - data.m_Backends, - inputInfo, - outputInfo, - desc, - weights.GetInfo(), - biases)) + bool isSupported = false; + FORWARD_LAYER_SUPPORT_FUNC(__func__, + IsConvolution2dSupported, + data.m_Backends, + isSupported, + inputInfo, + outputInfo, + desc, + weights.GetInfo(), + biases); + if (!isSupported) { return false; } @@ -428,14 +431,17 @@ bool HalPolicy::ConvertDepthwiseConv2d(const Operation& operation, const Model& desc.m_BiasEnabled = true; armnn::Optional biases(bias.GetInfo()); - if (!IsLayerSupportedForAnyBackend(__func__, - armnn::IsDepthwiseConvolutionSupported, - data.m_Backends, - inputInfo, - outputInfo, - desc, - weights.GetInfo(), - biases)) + bool isSupported = false; + FORWARD_LAYER_SUPPORT_FUNC(__func__, + IsDepthwiseConvolutionSupported, + data.m_Backends, + isSupported, + inputInfo, + outputInfo, + desc, + weights.GetInfo(), + biases); + if (!isSupported) { return false; } @@ -578,12 +584,15 @@ bool HalPolicy::ConvertPadV2(const Operation& operation, const Model& model, Con return Fail("%s: Operation has invalid inputs: type mismatch", __func__); } - 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; } @@ -628,12 +637,15 @@ bool HalPolicy::ConvertPrelu(const Operation& operation, const Model& model, Con outputInfo.SetShape(InferPreluOutputShape(inputInfo.GetShape(), alphaInfo.GetShape())); } - if (!IsLayerSupportedForAnyBackend(__func__, - armnn::IsPreluSupported, - data.m_Backends, - inputInfo, - alphaInfo, - outputInfo)) + bool isSupported = false; + FORWARD_LAYER_SUPPORT_FUNC(__func__, + IsPreluSupported, + data.m_Backends, + isSupported, + inputInfo, + alphaInfo, + outputInfo); + if (!isSupported) { return false; } @@ -741,12 +753,15 @@ bool HalPolicy::ConvertResize(const Operation& operation, return false; } - if (!IsLayerSupportedForAnyBackend(__func__, - armnn::IsResizeSupported, - data.m_Backends, - inputInfo, - outputInfo, - descriptor)) + bool isSupported = false; + FORWARD_LAYER_SUPPORT_FUNC(__func__, + IsResizeSupported, + data.m_Backends, + isSupported, + inputInfo, + outputInfo, + descriptor); + if (!isSupported) { return false; } @@ -796,12 +811,16 @@ bool HalPolicy::ConvertSpaceToDepth(const Operation& operation, const Model& mod } const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output); - if (!IsLayerSupportedForAnyBackend(__func__, - armnn::IsSpaceToDepthSupported, - data.m_Backends, - inputInfo, - outputInfo, - desc)) + + bool isSupported = false; + FORWARD_LAYER_SUPPORT_FUNC(__func__, + IsSpaceToDepthSupported, + data.m_Backends, + isSupported, + inputInfo, + outputInfo, + desc); + if (!isSupported) { return false; } -- cgit v1.2.1