diff options
author | telsoa01 <telmo.soares@arm.com> | 2018-03-09 14:13:49 +0000 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-03-09 14:13:49 +0000 |
commit | 4fcda0101ec3d110c1d6d7bee5c83416b645528a (patch) | |
tree | c9a70aeb2887006160c1b3d265c27efadb7bdbae /src/armnn/LayerSupportCommon.hpp | |
download | armnn-4fcda0101ec3d110c1d6d7bee5c83416b645528a.tar.gz |
Release 18.02
Change-Id: Id3c11dc5ee94ef664374a988fcc6901e9a232fa6
Diffstat (limited to 'src/armnn/LayerSupportCommon.hpp')
-rw-r--r-- | src/armnn/LayerSupportCommon.hpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/armnn/LayerSupportCommon.hpp b/src/armnn/LayerSupportCommon.hpp new file mode 100644 index 0000000000..5b7feac387 --- /dev/null +++ b/src/armnn/LayerSupportCommon.hpp @@ -0,0 +1,64 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#pragma once + +#include <armnn/DescriptorsFwd.hpp> +#include <armnn/Types.hpp> +#include <armnn/Tensor.hpp> + +namespace armnn +{ + +template<typename Float32Func, typename Uint8Func, typename ... Params> +bool IsSupportedForDataTypeGeneric(std::string* reasonIfUnsupported, + DataType dataType, + Float32Func floatFuncPtr, + Uint8Func uint8FuncPtr, + Params&&... params) +{ + switch(dataType) + { + case DataType::Float32: + return floatFuncPtr(reasonIfUnsupported, std::forward<Params>(params)...); + case DataType::QuantisedAsymm8: + return uint8FuncPtr(reasonIfUnsupported, std::forward<Params>(params)...); + default: + return false; + } +} + +template<typename ... Params> +bool TrueFunc(std::string* reasonIfUnsupported, Params&&... params) +{ + return true; +} + +template<typename ... Params> +bool FalseFunc(std::string* reasonIfUnsupported, Params&&... params) +{ + return false; +} + +template<typename ... Params> +bool FalseFuncF32(std::string* reasonIfUnsupported, Params&&... params) +{ + if (reasonIfUnsupported) + { + *reasonIfUnsupported = "Layer is not supported with float32 data type"; + } + return false; +} + +template<typename ... Params> +bool FalseFuncU8(std::string* reasonIfUnsupported, Params&&... params) +{ + if (reasonIfUnsupported) + { + *reasonIfUnsupported = "Layer is not supported with 8-bit data type"; + } + return false; +} + +} |