ArmNN
 23.08
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],
34  reasonIfUnsupported);
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
armnn::Optional
Definition: Optional.hpp:270
SampleDynamicLayerSupport.hpp
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::DataType::Float32
@ Float32
sdb
Definition: SampleDynamicAdditionWorkload.cpp:11
LayerSupportCommon.hpp
armnn::LayerType::Addition
@ Addition
armnn::BaseDescriptor
Base class for all descriptors.
Definition: Descriptors.hpp:22
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
Default implementation of the ILayerSupport interface, Backends should implement this as a switch sta...
Definition: SampleDynamicLayerSupport.cpp:15
armnn::TensorInfo::GetDataType
DataType GetDataType() const
Definition: Tensor.hpp:198
Types.hpp
InternalTypes.hpp
sdb::SampleDynamicLayerSupport::IsInputSupported
bool IsInputSupported(const armnn::TensorInfo &input, armnn::Optional< std::string & > reasonIfUnsupported) const
Definition: SampleDynamicLayerSupport.cpp:40
armnn::LayerType::Input
@ Input
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
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:483
armnn::LayerType::Output
@ Output
sdb::SampleDynamicLayerSupport::IsOutputSupported
bool IsOutputSupported(const armnn::TensorInfo &output, armnn::Optional< std::string & > reasonIfUnsupported) const
Definition: SampleDynamicLayerSupport.cpp:46