diff options
author | mathad01 <matthew.haddon@arm.com> | 2021-04-07 12:07:30 +0100 |
---|---|---|
committer | mathad01 <matthew.haddon@arm.com> | 2021-04-12 15:31:28 +0100 |
commit | b392e9845b7f40ab0c389f29f13f6ec84dd814d1 (patch) | |
tree | d71d260f7ff5ba7498ea653174bd166f27865ee5 /src/backends/reference/RefLayerSupport.cpp | |
parent | 35ad91c489312c23dddac5e6dffde840fbb85b79 (diff) | |
download | armnn-b392e9845b7f40ab0c389f29f13f6ec84dd814d1.tar.gz |
IVGCVSW-5410 Add front-end support for CAST
IVGCVSW-5415 Add TfLiteParser support for CAST
* Added front end support for CAST, including support in the
Reference workload, Serialization, Deserializtion, Unit tests, and
TfLiteParser.
Signed-off-by: mathad01 <matthew.haddon@arm.com>
Change-Id: Iaf670ca5912a21ed6bc84f7f83a68b42154846bb
Diffstat (limited to 'src/backends/reference/RefLayerSupport.cpp')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index 2e0a8f2faa..e278e45f01 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -303,6 +303,36 @@ bool RefLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, return supported; } +bool RefLayerSupport::IsCastSupported(const TensorInfo& input, + const TensorInfo& output, + Optional<std::string&> reasonIfUnsupported) const +{ + std::array<DataType, 9> supportedInputTypes = + { + DataType::BFloat16, + DataType::Float32, + DataType::Float16, + DataType::QSymmS8, + DataType::QAsymmS8, + DataType::QAsymmU8, + DataType::QSymmS16, + DataType::Signed32 + }; + + bool supported = true; + supported &= CheckSupportRule(TypeAnyOf(input, supportedInputTypes), reasonIfUnsupported, + "Reference cast: input is not a supported type"); + + + supported &= CheckSupportRule(TypeAnyOf(output, supportedInputTypes), reasonIfUnsupported, + "Reference cast: output is not a supported type"); + + supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, + "Reference cast: input and output shapes have different number of total elements"); + + return supported; +} + bool RefLayerSupport::IsComparisonSupported(const TensorInfo& input0, const TensorInfo& input1, const TensorInfo& output, |