diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-06-03 16:54:25 +0100 |
---|---|---|
committer | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-06-04 15:13:51 +0000 |
commit | 3122bd574a3d29774c535ca2136de361da626e88 (patch) | |
tree | c2fcc19be67f5a35c30d042b80ba3157ef87bd21 /src/backends/reference/RefLayerSupport.cpp | |
parent | 550fe36f687e73c78b57ebfeee9f98fd35f40f24 (diff) | |
download | armnn-3122bd574a3d29774c535ca2136de361da626e88.tar.gz |
IVGCVSW-3212 Refactor the Reference BatchNormalization workloads to
handle Float32 and QAsymm8 types
* Removed the type-specific workload implementations
* Added type-independent RefBatchNormalizationWorkload implementation
* Reworked BachNormImpl to use decoders/encoders
* Improved the validation of the BatchNorm queue descriptor
* Fixed unit tests where necessary
Change-Id: Icf3fa1332292d38ec2fa0b1cb984cab78426034b
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/backends/reference/RefLayerSupport.cpp')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index edd552b2ac..aeff51d853 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -280,22 +280,44 @@ bool RefLayerSupport::IsAdditionSupported(const TensorInfo& input0, bool RefLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, const TensorInfo& output, const TensorInfo& mean, - const TensorInfo& var, + const TensorInfo& variance, const TensorInfo& beta, const TensorInfo& gamma, const BatchNormalizationDescriptor& descriptor, Optional<std::string&> reasonIfUnsupported) const { - ignore_unused(output); - ignore_unused(mean); - ignore_unused(var); - ignore_unused(beta); - ignore_unused(gamma); ignore_unused(descriptor); - return IsSupportedForDataTypeRef(reasonIfUnsupported, - input.GetDataType(), - &TrueFunc<>, - &TrueFunc<>); + + std::array<DataType, 2> supportedTypes = + { + DataType::Float32, + DataType::QuantisedAsymm8 + }; + + bool supported = true; + + supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: input is not a supported type."); + + supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: output is not a supported type."); + + supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, + "Reference batch normalization: input and output types are mismatched"); + + supported &= CheckSupportRule(TypeAnyOf(mean, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: mean is not a supported type."); + + supported &= CheckSupportRule(TypeAnyOf(variance, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: variance is not a supported type."); + + supported &= CheckSupportRule(TypeAnyOf(beta, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: beta is not a supported type."); + + supported &= CheckSupportRule(TypeAnyOf(gamma, supportedTypes), reasonIfUnsupported, + "Reference batch normalization: gamma is not a supported type."); + + return supported; } bool RefLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |