ArmNN
 23.05
SampleDynamicLayerSupport.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include <InternalTypes.hpp>
9 #include <LayerSupportCommon.hpp>
10 #include <armnn/Types.hpp>
11 
12 namespace sdb // sample dynamic backend
13 {
14 
16  const std::vector<armnn::TensorInfo>& infos,
17  const armnn::BaseDescriptor& /*descriptor*/,
19  /*lstmParamsInfo*/,
21  /*quantizedLstmParamsInfo*/,
22  armnn::Optional<std::string&> reasonIfUnsupported) const
23 {
24  switch (type)
25  {
27  return IsInputSupported(infos[0], reasonIfUnsupported);
29  return IsOutputSupported(infos[0], reasonIfUnsupported);
31  return IsAdditionSupported(infos[0],
32  infos[1],
33  infos[2],
35  default:
36  return false;
37  }
38 }
39 
41  armnn::Optional<std::string&> reasonIfUnsupported) const
42 {
43  return true;
44 }
45 
47  armnn::Optional<std::string&> reasonIfUnsupported) const
48 {
49  return true;
50 }
51 
53  const armnn::TensorInfo& input1,
54  const armnn::TensorInfo& output,
55  armnn::Optional<std::string&> reasonIfUnsupported) const
56 {
57 
58  if (input0.GetDataType() != armnn::DataType::Float32)
59  {
60  return false;
61  }
62 
63  if (input0.GetDataType() != input1.GetDataType())
64  {
65  return false;
66  }
67 
68  if (input0.GetDataType() != output.GetDataType())
69  {
70  return false;
71  }
72 
73  return true;
74 }
75 
76 } // namespace sdb
sdb
Definition: SampleDynamicAdditionWorkload.cpp:11
armnn::LayerType::Input
@ Input
armnn::ILayerSupport::reasonIfUnsupported
const TensorInfo const ActivationDescriptor Optional< std::string & > reasonIfUnsupported
Definition: ILayerSupport.hpp:43
sdb::SampleDynamicLayerSupport::IsInputSupported
bool IsInputSupported(const armnn::TensorInfo &input, armnn::Optional< std::string & > reasonIfUnsupported) const override
Definition: SampleDynamicLayerSupport.cpp:40
SampleDynamicLayerSupport.hpp
armnn::LayerType::Addition
@ Addition
sdb::SampleDynamicLayerSupport::IsAdditionSupported
bool IsAdditionSupported(const armnn::TensorInfo &input0, const armnn::TensorInfo &input1, const armnn::TensorInfo &output, armnn::Optional< std::string & > reasonIfUnsupported=armnn::EmptyOptional()) const override
Definition: SampleDynamicLayerSupport.cpp:52
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:479
InternalTypes.hpp
armnn::DataType::Float32
@ Float32
armnn::ILayerSupport::input1
const TensorInfo & input1
Definition: ILayerSupport.hpp:48
armnn::TensorInfo
Definition: Tensor.hpp:152
LayerSupportCommon.hpp
sdb::SampleDynamicLayerSupport::IsOutputSupported
bool IsOutputSupported(const armnn::TensorInfo &output, armnn::Optional< std::string & > reasonIfUnsupported) const override
Definition: SampleDynamicLayerSupport.cpp:46
sdb::SampleDynamicLayerSupport::IsLayerSupported
bool IsLayerSupported(const armnn::LayerType &type, const std::vector< armnn::TensorInfo > &infos, const armnn::BaseDescriptor &descriptor, const armnn::Optional< armnn::LstmInputParamsInfo > &lstmParamsInfo, const armnn::Optional< armnn::QuantizedLstmInputParamsInfo > &quantizedLstmParamsInfo, armnn::Optional< std::string & > reasonIfUnsupported=armnn::EmptyOptional()) const override
Definition: SampleDynamicLayerSupport.cpp:15
armnn::BaseDescriptor
Base class for all descriptors.
Definition: Descriptors.hpp:22
armnn::Optional
Definition: Optional.hpp:270
armnn::ILayerSupport::output
const TensorInfo & output
Definition: ILayerSupport.hpp:41
Types.hpp
armnn::LayerType::Output
@ Output
armnn::TensorInfo::GetDataType
DataType GetDataType() const
Definition: Tensor.hpp:198