diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2021-11-17 15:01:00 +0000 |
---|---|---|
committer | Sadik Armagan <sadik.armagan@arm.com> | 2021-11-18 16:43:17 +0000 |
commit | 1342bed114effa8b183ba683189117cd730ab635 (patch) | |
tree | 8561e8eceb6043d74a0c69197de62fcbd3d8dd8e /src/armnnUtils/CompatibleTypes.cpp | |
parent | f9de771083f1f32393b0fe5a3bcdedf4c148be15 (diff) | |
download | armnn-1342bed114effa8b183ba683189117cd730ab635.tar.gz |
IVGCVSW-6452 'Move CompatibleTypes.hpp to the armnnUtils library'
* Moved CompatibleTypes.hpp to include folder
* Added implementation file to source CompatibleTypes.cpp
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I94d2bffdb82a0592943f497d4f57972151d9f2db
Diffstat (limited to 'src/armnnUtils/CompatibleTypes.cpp')
-rw-r--r-- | src/armnnUtils/CompatibleTypes.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/armnnUtils/CompatibleTypes.cpp b/src/armnnUtils/CompatibleTypes.cpp new file mode 100644 index 0000000000..9a3251d293 --- /dev/null +++ b/src/armnnUtils/CompatibleTypes.cpp @@ -0,0 +1,65 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// +#include <armnn/Types.hpp> +#include <armnnUtils/CompatibleTypes.hpp> + +#include "BFloat16.hpp" +#include "Half.hpp" + +using namespace armnn; + +namespace armnnUtils +{ + +template<typename T> +bool CompatibleTypes(DataType) +{ + return false; +} + +template<> +bool CompatibleTypes<float>(DataType dataType) +{ + return dataType == DataType::Float32; +} + +template<> +bool CompatibleTypes<Half>(DataType dataType) +{ + return dataType == DataType::Float16; +} + +template<> +bool CompatibleTypes<BFloat16>(DataType dataType) +{ + return dataType == DataType::BFloat16; +} + +template<> +bool CompatibleTypes<uint8_t>(DataType dataType) +{ + return dataType == DataType::Boolean || dataType == DataType::QAsymmU8; +} + +template<> +bool CompatibleTypes<int8_t>(DataType dataType) +{ + return dataType == DataType::QSymmS8 + || dataType == DataType::QAsymmS8; +} + +template<> +bool CompatibleTypes<int16_t>(DataType dataType) +{ + return dataType == DataType::QSymmS16; +} + +template<> +bool CompatibleTypes<int32_t>(DataType dataType) +{ + return dataType == DataType::Signed32; +} + +} //namespace armnnUtils |