blob: 1223ba893a84b8e8c3daf1acb74ac9399bf43ec0 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5#pragma once
6
David Beck3cc9a622018-10-12 10:38:31 +01007#include <armnn/ILayerSupport.hpp>
telsoa014fcda012018-03-09 14:13:49 +00008
9namespace armnn
10{
11
arovir014424b0a2018-10-04 10:46:04 +010012class NeonLayerSupport : public ILayerSupport
13{
arovir017ff76c52018-10-09 09:40:58 +010014public:
15 bool IsActivationSupported(const TensorInfo& input,
16 const TensorInfo& output,
17 const ActivationDescriptor& descriptor,
18 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
19
20 bool IsAdditionSupported(const TensorInfo& input0,
21 const TensorInfo& input1,
22 const TensorInfo& output,
23 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
24
25 bool IsBatchNormalizationSupported(const TensorInfo& input,
26 const TensorInfo& output,
27 const TensorInfo& mean,
28 const TensorInfo& var,
29 const TensorInfo& beta,
30 const TensorInfo& gamma,
31 const BatchNormalizationDescriptor& descriptor,
32 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
33
34 bool IsConstantSupported(const TensorInfo& output,
35 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
36
37 bool IsConvertFp16ToFp32Supported(const TensorInfo& input,
38 const TensorInfo& output,
39 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
40
41 bool IsConvertFp32ToFp16Supported(const TensorInfo& input,
42 const TensorInfo& output,
43 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
44
45 bool IsConvolution2dSupported(const TensorInfo& input,
46 const TensorInfo& output,
47 const Convolution2dDescriptor& descriptor,
48 const TensorInfo& weights,
49 const Optional<TensorInfo>& biases,
50 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
51
52 bool IsDepthwiseConvolutionSupported(const TensorInfo& input,
53 const TensorInfo& output,
54 const DepthwiseConvolution2dDescriptor& descriptor,
55 const TensorInfo& weights,
56 const Optional<TensorInfo>& biases,
57 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
58
59 bool IsDivisionSupported(const TensorInfo& input0,
60 const TensorInfo& input1,
61 const TensorInfo& output,
62 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
63
64 bool IsFakeQuantizationSupported(const TensorInfo& input,
65 const FakeQuantizationDescriptor& descriptor,
66 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
67
68 bool IsFloorSupported(const TensorInfo& input,
69 const TensorInfo& output,
70 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
71
72 bool IsFullyConnectedSupported(const TensorInfo& input,
73 const TensorInfo& output,
74 const TensorInfo& weights,
75 const TensorInfo& biases,
76 const FullyConnectedDescriptor& descriptor,
77 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
78
79 bool IsInputSupported(const TensorInfo& input,
80 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
81
82 bool IsL2NormalizationSupported(const TensorInfo& input,
83 const TensorInfo& output,
84 const L2NormalizationDescriptor& descriptor,
85 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
86
87 bool IsLstmSupported(const TensorInfo& input,
88 const TensorInfo& outputStateIn,
89 const TensorInfo& cellStateIn,
90 const TensorInfo& scratchBuffer,
91 const TensorInfo& outputStateOut,
92 const TensorInfo& cellStateOut,
93 const TensorInfo& output,
94 const LstmDescriptor& descriptor,
95 const TensorInfo& inputToForgetWeights,
96 const TensorInfo& inputToCellWeights,
97 const TensorInfo& inputToOutputWeights,
98 const TensorInfo& recurrentToForgetWeights,
99 const TensorInfo& recurrentToCellWeights,
100 const TensorInfo& recurrentToOutputWeights,
101 const TensorInfo& forgetGateBias,
102 const TensorInfo& cellBias,
103 const TensorInfo& outputGateBias,
104 const TensorInfo* inputToInputWeights,
105 const TensorInfo* recurrentToInputWeights,
106 const TensorInfo* cellToInputWeights,
107 const TensorInfo* inputGateBias,
108 const TensorInfo* projectionWeights,
109 const TensorInfo* projectionBias,
110 const TensorInfo* cellToForgetWeights,
111 const TensorInfo* cellToOutputWeights,
112 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
113
114 bool IsMeanSupported(const TensorInfo& input,
115 const TensorInfo& output,
116 const MeanDescriptor& descriptor,
117 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
118
119 bool IsMergerSupported(const std::vector<const TensorInfo*> inputs,
120 const OriginsDescriptor& descriptor,
121 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
122
123 bool IsMultiplicationSupported(const TensorInfo& input0,
124 const TensorInfo& input1,
125 const TensorInfo& output,
126 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
127
128 bool IsNormalizationSupported(const TensorInfo& input,
129 const TensorInfo& output,
130 const NormalizationDescriptor& descriptor,
131 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
132
133 bool IsOutputSupported(const TensorInfo& output,
134 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
135
136 bool IsPadSupported(const TensorInfo& input,
137 const TensorInfo& output,
138 const PadDescriptor& descriptor,
139 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
140
141 bool IsPermuteSupported(const TensorInfo& input,
142 const TensorInfo& output,
143 const PermuteDescriptor& descriptor,
144 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
145
146 bool IsPooling2dSupported(const TensorInfo& input,
147 const TensorInfo& output,
148 const Pooling2dDescriptor& descriptor,
149 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
150
151 bool IsReshapeSupported(const TensorInfo& input,
152 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
153
154 bool IsResizeBilinearSupported(const TensorInfo& input,
155 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
156
157 bool IsSoftmaxSupported(const TensorInfo& input,
158 const TensorInfo& output,
159 const SoftmaxDescriptor& descriptor,
160 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
161
162 bool IsSplitterSupported(const TensorInfo& input,
163 const ViewsDescriptor& descriptor,
164 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
165
166 bool IsSubtractionSupported(const TensorInfo& input0,
167 const TensorInfo& input1,
168 const TensorInfo& output,
169 Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override;
arovir014424b0a2018-10-04 10:46:04 +0100170};
171
telsoa014fcda012018-03-09 14:13:49 +0000172bool IsNeonDirectConvolutionPreferred(const TensorInfo& weightInfo, const Convolution2dDescriptor& desc);
173
arovir01085f0a42018-10-08 14:48:19 +0100174bool IsNeonNormalizationDescParamsSupported(Optional<std::string&> reasonIfUnsupported,
telsoa014fcda012018-03-09 14:13:49 +0000175 const NormalizationDescriptor& parameters);
176
177bool IsActivationSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100178 const TensorInfo& output,
telsoa014fcda012018-03-09 14:13:49 +0000179 const ActivationDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100180 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000181
arovir01085f0a42018-10-08 14:48:19 +0100182bool IsNeonDepthwiseConvolution2dDescParamsSupported(Optional<std::string&> reasonIfUnsupported,
telsoa014fcda012018-03-09 14:13:49 +0000183 const DepthwiseConvolution2dDescriptor& parameters,
184 const TensorInfo& weights);
185
186bool IsAdditionSupportedNeon(const TensorInfo& input0,
187 const TensorInfo& input1,
188 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100189 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000190
191bool IsBatchNormalizationSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100192 const TensorInfo& output,
193 const TensorInfo& mean,
194 const TensorInfo& var,
195 const TensorInfo& beta,
196 const TensorInfo& gamma,
telsoa014fcda012018-03-09 14:13:49 +0000197 const BatchNormalizationDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100198 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000199
200bool IsConstantSupportedNeon(const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100201 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000202
203bool IsConvolution2dSupportedNeon(const TensorInfo& input,
surmeh013537c2c2018-05-18 16:31:43 +0100204 const TensorInfo& output,
telsoa014fcda012018-03-09 14:13:49 +0000205 const Convolution2dDescriptor& descriptor,
206 const TensorInfo& weights,
David Beck5eec11d2018-10-04 15:43:17 +0100207 const Optional<TensorInfo>& biases,
arovir01085f0a42018-10-08 14:48:19 +0100208 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000209
telsoa01c577f2c2018-08-31 09:22:23 +0100210
telsoa014fcda012018-03-09 14:13:49 +0000211bool IsDepthwiseConvolutionSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100212 const TensorInfo& output,
telsoa014fcda012018-03-09 14:13:49 +0000213 const DepthwiseConvolution2dDescriptor& descriptor,
214 const TensorInfo& weights,
David Beck5eec11d2018-10-04 15:43:17 +0100215 const Optional<TensorInfo>& biases,
arovir01085f0a42018-10-08 14:48:19 +0100216 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000217
Francis Murtaghe7a86a42018-08-29 12:42:10 +0100218bool IsDivisionSupportedNeon(const TensorInfo& input0,
219 const TensorInfo& input1,
220 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100221 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
Francis Murtaghe7a86a42018-08-29 12:42:10 +0100222
David Beckc2044fe2018-09-05 15:00:38 +0100223bool IsSubtractionSupportedNeon(const TensorInfo& input0,
224 const TensorInfo& input1,
225 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100226 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
David Beckc2044fe2018-09-05 15:00:38 +0100227
telsoa014fcda012018-03-09 14:13:49 +0000228bool IsFullyConnectedSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100229 const TensorInfo& output,
230 const TensorInfo& weights,
231 const TensorInfo& biases,
telsoa014fcda012018-03-09 14:13:49 +0000232 const FullyConnectedDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100233 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000234
235bool IsInputSupportedNeon(const TensorInfo& input,
arovir01085f0a42018-10-08 14:48:19 +0100236 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000237
238bool IsL2NormalizationSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100239 const TensorInfo& output,
Matteo Martincighbcd3c852018-09-28 14:14:12 +0100240 const L2NormalizationDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100241 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000242
243bool IsMergerSupportedNeon(const std::vector<const TensorInfo*> inputs,
244 const OriginsDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100245 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000246
247bool IsMultiplicationSupportedNeon(const TensorInfo& input0,
248 const TensorInfo& input1,
telsoa01c577f2c2018-08-31 09:22:23 +0100249 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100250 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000251
252bool IsNormalizationSupportedNeon(const TensorInfo& input,
253 const TensorInfo& output,
254 const NormalizationDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100255 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000256
257bool IsOutputSupportedNeon(const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100258 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000259
260bool IsPermuteSupportedNeon(const TensorInfo& input,
261 const TensorInfo& output,
262 const PermuteDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100263 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000264
265bool IsPooling2dSupportedNeon(const TensorInfo& input,
266 const TensorInfo& output,
267 const Pooling2dDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100268 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000269
270bool IsResizeBilinearSupportedNeon(const TensorInfo& input,
arovir01085f0a42018-10-08 14:48:19 +0100271 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000272
273bool IsSoftmaxSupportedNeon(const TensorInfo& input,
telsoa01c577f2c2018-08-31 09:22:23 +0100274 const TensorInfo& output,
telsoa014fcda012018-03-09 14:13:49 +0000275 const SoftmaxDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100276 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000277
278bool IsSplitterSupportedNeon(const TensorInfo& input,
279 const ViewsDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100280 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000281
282bool IsFakeQuantizationSupportedNeon(const TensorInfo& input,
283 const FakeQuantizationDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100284 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000285
286bool IsReshapeSupportedNeon(const TensorInfo& input,
arovir01085f0a42018-10-08 14:48:19 +0100287 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000288
289bool IsFloorSupportedNeon(const TensorInfo& input,
290 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100291 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa014fcda012018-03-09 14:13:49 +0000292
arovir01085f0a42018-10-08 14:48:19 +0100293bool IsLstmSupportedNeon(const TensorInfo& input,
294 const TensorInfo& outputStateIn,
295 const TensorInfo& cellStateIn,
296 const TensorInfo& scratchBuffer,
297 const TensorInfo& outputStateOut,
298 const TensorInfo& cellStateOut,
299 const TensorInfo& output,
300 const LstmDescriptor& descriptor,
301 const TensorInfo& inputToForgetWeights,
302 const TensorInfo& inputToCellWeights,
303 const TensorInfo& inputToOutputWeights,
304 const TensorInfo& recurrentToForgetWeights,
305 const TensorInfo& recurrentToCellWeights,
306 const TensorInfo& recurrentToOutputWeights,
307 const TensorInfo& forgetGateBias,
308 const TensorInfo& cellBias,
309 const TensorInfo& outputGateBias,
310 const TensorInfo* inputToInputWeights,
311 const TensorInfo* recurrentToInputWeights,
312 const TensorInfo* cellToInputWeights,
313 const TensorInfo* inputGateBias,
314 const TensorInfo* projectionWeights,
315 const TensorInfo* projectionBias,
316 const TensorInfo* cellToForgetWeights,
317 const TensorInfo* cellToOutputWeights,
318 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa01c577f2c2018-08-31 09:22:23 +0100319
320bool IsConvertFp16ToFp32SupportedNeon(const TensorInfo& input,
321 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100322 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa01c577f2c2018-08-31 09:22:23 +0100323
324bool IsConvertFp32ToFp16SupportedNeon(const TensorInfo& input,
325 const TensorInfo& output,
arovir01085f0a42018-10-08 14:48:19 +0100326 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
telsoa01c577f2c2018-08-31 09:22:23 +0100327
narpra0132b90462018-09-13 11:07:48 +0100328bool IsMeanSupportedNeon(const TensorInfo& input,
329 const TensorInfo& output,
330 const MeanDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100331 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
narpra0132b90462018-09-13 11:07:48 +0100332
Nina Drozd661dfa72018-10-02 11:14:17 +0100333bool IsPadSupportedNeon(const TensorInfo& input,
334 const TensorInfo& output,
335 const PadDescriptor& descriptor,
arovir01085f0a42018-10-08 14:48:19 +0100336 Optional<std::string&> reasonIfUnsupported = EmptyOptional());
Nina Drozd661dfa72018-10-02 11:14:17 +0100337
arovir017ff76c52018-10-09 09:40:58 +0100338} // namespace armnn