ArmNN
 21.02
ILayerVisitor.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Deprecated.hpp>
9 #include <armnn/NetworkFwd.hpp>
10 #include <armnn/Optional.hpp>
11 #include <armnn/TensorFwd.hpp>
12 #include <armnn/Types.hpp>
13 
14 namespace armnn
15 {
17 {
18 protected:
20  virtual ~ILayerVisitor() {}
21 
22 public:
23  /// Function an absolute layer should call back to when its Accept(ILayerVisitor&)
24  /// function is invoked.
25  /// @param layer - pointer to the layer which is calling back to this visit function.
26  /// @param name - Optional name for the layer.
27  ARMNN_DEPRECATED_MSG("Use VisitElementwiseUnaryLayer instead")
28  virtual void VisitAbsLayer(const IConnectableLayer* layer,
29  const char* name = nullptr) = 0;
30 
31  /// Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
32  /// @param layer - pointer to the layer which is calling back to this visit function.
33  /// @param activationDescriptor - ActivationDescriptor to configure the activation.
34  /// @param name - Optional name for the layer.
35  virtual void VisitActivationLayer(const IConnectableLayer* layer,
36  const ActivationDescriptor& activationDescriptor,
37  const char* name = nullptr) = 0;
38 
39  /// Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked.
40  /// @param layer - pointer to the layer which is calling back to this visit function.
41  /// @param name - Optional name for the layer.
42  virtual void VisitAdditionLayer(const IConnectableLayer* layer,
43  const char* name = nullptr) = 0;
44 
45  /// Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked.
46  /// @param layer - pointer to the layer which is calling back to this visit function.
47  /// @param argMinMaxDescriptor - ArgMinMaxDescriptor to configure the activation.
48  /// @param name - Optional name for the layer.
49  virtual void VisitArgMinMaxLayer(const IConnectableLayer* layer,
50  const ArgMinMaxDescriptor& argMinMaxDescriptor,
51  const char* name = nullptr) = 0;
52 
53  /// Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&)
54  /// function is invoked.
55  /// @param layer - pointer to the layer which is calling back to this visit function.
56  /// @param mean - Pre-calculated mean for each channel.
57  /// @param variance - Pre-calculated variance for each channel.
58  /// @param beta - Per-channel additive factor.
59  /// @param gamma - Per-channel multiplicative factor.
60  /// @param name - Optional name for the layer.
61  virtual void VisitBatchNormalizationLayer(const IConnectableLayer* layer,
62  const BatchNormalizationDescriptor& desc,
63  const ConstTensor& mean,
64  const ConstTensor& variance,
65  const ConstTensor& beta,
66  const ConstTensor& gamma,
67  const char* name = nullptr) = 0;
68 
69  /// Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&)
70  /// function is invoked.
71  /// @param layer - pointer to the layer which is calling back to this visit function.
72  /// @param batchToSpaceNdDescriptor - Description of the layer.
73  /// @param name - Optional name for the layer.
74  virtual void VisitBatchToSpaceNdLayer(const IConnectableLayer* layer,
75  const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor,
76  const char* name = nullptr) = 0;
77 
78  /// Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked.
79  /// @param layer - pointer to the layer which is calling back to this visit function.
80  /// @param comparisonDescriptor - Description of the layer.
81  /// @param name - Optional name for the layer.
82  virtual void VisitComparisonLayer(const IConnectableLayer* layer,
83  const ComparisonDescriptor& comparisonDescriptor,
84  const char* name = nullptr) = 0;
85 
86  /// Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked.
87  /// @param layer - pointer to the layer which is calling back to this visit function.
88  /// @param concatDescriptor - ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation
89  /// process. Number of Views must be equal to the number of inputs, and their order
90  /// must match - e.g. first view corresponds to the first input, second view to the
91  /// second input, etc....
92  /// @param name - Optional name for the layer.
93  virtual void VisitConcatLayer(const IConnectableLayer* layer,
94  const OriginsDescriptor& concatDescriptor,
95  const char* name = nullptr)
96  {
97  // default implementation to ease transition while MergerLayer is being deprecated
99  VisitMergerLayer(layer, concatDescriptor, name);
101  }
102 
103  /// Function a layer with no inputs and a single output, which always corresponds to
104  /// the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked.
105  /// @param layer - pointer to the layer which is calling back to this visit function.
106  /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain
107  /// its own copy of the tensor data, meaning the memory referenced by @a input can
108  /// be freed or reused after this function is called.
109  /// @param name - Optional name for the layer.
110  virtual void VisitConstantLayer(const IConnectableLayer* layer,
111  const ConstTensor& input,
112  const char* name = nullptr) = 0;
113 
114  /// Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&)
115  /// function is invoked.
116  /// @param layer - pointer to the layer which is calling back to this visit function.
117  /// @param convolution2dDescriptor - Description of the 2D convolution layer.
118  /// @param weights - Tensor for the weights data.
119  /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
120  /// @param name - Optional name for the layer.
121  virtual void VisitConvolution2dLayer(const IConnectableLayer* layer,
122  const Convolution2dDescriptor& convolution2dDescriptor,
123  const ConstTensor& weights,
124  const Optional<ConstTensor>& biases,
125  const char* name = nullptr) = 0;
126 
127  /// Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked.
128  /// @param layer - pointer to the layer which is calling back to this visit function.
129  /// @param depthToSpaceDescriptor - Parameters for the depth to space operation.
130  /// @param name - Optional name for the layer.
131  virtual void VisitDepthToSpaceLayer(const IConnectableLayer* layer,
132  const DepthToSpaceDescriptor& depthToSpaceDescriptor,
133  const char* name = nullptr) = 0;
134 
135  /// Function that a 2D depthwise convolution layer with biases should call back to when its
136  /// Accept(ILayerVisitor&) function is invoked.
137  /// @param layer - pointer to the layer which is calling back to this visit function.
138  /// @param convolution2dDescriptor - Description of the 2D depthwise convolution layer.
139  /// @param weights - Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
140  /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
141  /// @param name - Optional name for the layer.
142  virtual void VisitDepthwiseConvolution2dLayer(const IConnectableLayer* layer,
143  const DepthwiseConvolution2dDescriptor& convolution2dDescriptor,
144  const ConstTensor& weights,
145  const Optional<ConstTensor>& biases,
146  const char* name = nullptr) = 0;
147 
148  /// Function that a Dequantize layer should call back to when its
149  /// Accept(ILayerVisitor&) function is invoked.
150  /// @param layer - pointer to the layer which is calling back to this visit function.
151  /// @param name - Optional name for the layer.
152  virtual void VisitDequantizeLayer(const IConnectableLayer* layer,
153  const char* name = nullptr) = 0;
154 
155  /// Function that a Detection PostProcess layer should call back to when its
156  /// Accept(ILayerVisitor&) function is invoked.
157  /// @param layer - pointer to the layer which is calling back to this visit function.
158  /// @param descriptor - Description of the Detection PostProcess layer.
159  /// @param anchors - Tensor for the anchors.
160  /// @param name - Optional name for the layer.
161  virtual void VisitDetectionPostProcessLayer(const IConnectableLayer* layer,
162  const DetectionPostProcessDescriptor& descriptor,
163  const ConstTensor& anchors,
164  const char* name = nullptr) = 0;
165 
166  /// Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked.
167  /// @param layer - pointer to the layer which is calling back to this visit function.
168  /// @param name - Optional name for the layer.
169  virtual void VisitDivisionLayer(const IConnectableLayer* layer,
170  const char* name = nullptr) = 0;
171 
172  /// Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked.
173  /// @param layer - pointer to the layer which is calling back to this visit function.
174  /// @param elementwiseUnaryDescriptor - Description of the layer.
175  /// @param name - Optional name for the layer.
176  virtual void VisitElementwiseUnaryLayer(const IConnectableLayer* layer,
177  const ElementwiseUnaryDescriptor& elementwiseUnaryDescriptor,
178  const char* name = nullptr) = 0;
179 
180  /// Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked.
181  /// @param layer - pointer to the layer which is calling back to this visit function.
182  /// @param name - Optional name for the layer.
183  ARMNN_DEPRECATED_MSG("Use VisitComparisonLayer instead")
184  virtual void VisitEqualLayer(const IConnectableLayer* layer,
185  const char* name = nullptr) = 0;
186 
187  /// Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked.
188  /// @param layer - pointer to the layer which is calling back to this visit function.
189  /// @param fillDescriptor - Description of the layer
190  /// @param name - Optional name for the layer.
191  virtual void VisitFillLayer(const IConnectableLayer* layer,
192  const FillDescriptor& fillDescriptor,
193  const char* name = nullptr) = 0;
194 
195  /// Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked.
196  /// @param layer - pointer to the layer which is calling back to this visit function.
197  /// @param name - Optional name for the layer.
198  virtual void VisitFloorLayer(const IConnectableLayer* layer,
199  const char* name = nullptr) = 0;
200 
201  /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&)
202  /// function is invoked.
203  /// @param layer - pointer to the layer which is calling back to this visit function.
204  /// @param fullyConnectedDescriptor - Description of the fully connected layer.
205  /// @param weights - Tensor for the weights data.
206  /// @param biases - Optional tensor for the bias data.
207  /// @param name - Optional name for the layer.
208  virtual void VisitFullyConnectedLayer(const IConnectableLayer* layer,
209  const FullyConnectedDescriptor& fullyConnectedDescriptor,
210  const ConstTensor& weights,
211  const Optional<ConstTensor>& biases,
212  const char* name = nullptr) = 0;
213 
214  /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
215  /// @param layer - pointer to the layer which is calling back to this visit function.
216  /// @param name - Optional name for the layer.
217  ARMNN_DEPRECATED_MSG("Use VisitGatherLayer with descriptor instead")
218  virtual void VisitGatherLayer(const IConnectableLayer* layer,
219  const char* name = nullptr) = 0;
220 
221  /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
222  /// @param layer - pointer to the layer which is calling back to this visit function.
223  /// @param gatherDescriptor - Parameters for the gather operation.
224  /// @param name - Optional name for the layer.
225  virtual void VisitGatherLayer(const IConnectableLayer* layer,
226  const GatherDescriptor& gatherDescriptor,
227  const char* name = nullptr) = 0;
228 
229  /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked.
230  /// @param layer - pointer to the layer which is calling back to this visit function.
231  /// @param name - Optional name for the layer.
232  ARMNN_DEPRECATED_MSG("Use VisitComparisonLayer instead")
233  virtual void VisitGreaterLayer(const IConnectableLayer* layer,
234  const char* name = nullptr) = 0;
235 
236  /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.
237  /// @param layer - pointer to the layer which is calling back to this visit function.
238  /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified
239  /// when passing the inputs to the IRuntime::EnqueueWorkload() function.
240  /// @param name - Optional name for the layer.
241  virtual void VisitInputLayer(const IConnectableLayer* layer,
242  LayerBindingId id,
243  const char* name = nullptr) = 0;
244 
245  /// Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&)
246  /// function is invoked.
247  /// @param layer - pointer to the layer which is calling back to this visit function.
248  /// @param desc - Parameters for the instance normalization operation.
249  /// @param name - Optional name for the layer.
250  virtual void VisitInstanceNormalizationLayer(const IConnectableLayer* layer,
252  const char* name = nullptr) = 0;
253 
254  /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&)
255  /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input.
256  /// @param layer - pointer to the layer which is calling back to this visit function.
257  /// @param desc - Parameters for the L2 normalization operation.
258  /// @param name - Optional name for the layer.
259  virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer,
260  const L2NormalizationDescriptor& desc,
261  const char* name = nullptr) = 0;
262 
263  /// Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
264  /// @param layer - pointer to the layer which is calling back to this visit function.
265  /// @param logSoftmaxDescriptor - LogSoftmaxDescriptor to configure the log softmax.
266  /// @param name - Optional name for the layer.
267  virtual void VisitLogSoftmaxLayer(const IConnectableLayer* layer,
268  const LogSoftmaxDescriptor& logSoftmaxDescriptor,
269  const char* name = nullptr) = 0;
270 
271  /// Function that a logical binary layer should call back to when its Accept(ILayerVisitor&) function is invoked.
272  /// @param layer - pointer to the layer which is calling back to this visit function.
273  /// @param logicalBinaryDescriptor - LogicalBinaryDescriptor to configure the logical unary layer.
274  /// @param name - Optional name for the layer.
275  virtual void VisitLogicalBinaryLayer(const IConnectableLayer* layer,
276  const LogicalBinaryDescriptor& logicalBinaryDescriptor,
277  const char* name = nullptr) = 0;
278 
279  /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
280  /// @param layer - pointer to the layer which is calling back to this visit function.
281  /// @param descriptor - Parameters controlling the operation of the Lstm operation.
282  /// @param params - The weights and biases for the LSTM cell.
283  /// @param name - Optional name for the layer.
284  virtual void VisitLstmLayer(const IConnectableLayer* layer,
285  const LstmDescriptor& descriptor,
286  const LstmInputParams& params,
287  const char* name = nullptr) = 0;
288 
289  /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
290  /// @param layer - pointer to the layer which is calling back to this visit function.
291  /// @param name - Optional name for the layer.
292  virtual void VisitMaximumLayer(const IConnectableLayer* layer,
293  const char* name = nullptr) = 0;
294 
295  /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.
296  /// @param layer - pointer to the layer which is calling back to this visit function.
297  /// @param meanDescriptor - Parameters for the mean operation.
298  /// @param name - Optional name for the layer.
299  virtual void VisitMeanLayer(const IConnectableLayer* layer,
300  const MeanDescriptor& meanDescriptor,
301  const char* name = nullptr) = 0;
302 
303  /// Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked.
304  /// @param layer - pointer to the layer which is calling back to this visit function.
305  /// @param name - Optional name for the layer.
306  virtual void VisitMergeLayer(const IConnectableLayer* layer,
307  const char* name = nullptr) = 0;
308 
309  /// Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked.
310  /// @param layer - pointer to the layer which is calling back to this visit function.
311  /// @param mergerDescriptor - MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation
312  /// process. Number of Views must be equal to the number of inputs, and their order
313  /// must match - e.g. first view corresponds to the first input, second view to the
314  /// second input, etc....
315  /// @param name - Optional name for the layer.
316  ARMNN_DEPRECATED_MSG("Use VisitConcatLayer instead")
317  virtual void VisitMergerLayer(const IConnectableLayer* layer,
318  const MergerDescriptor& mergerDescriptor,
319  const char* name = nullptr) = 0;
320 
321  /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
322  /// @param layer - pointer to the layer which is calling back to this visit function.
323  /// @param name - Optional name for the layer.
324  virtual void VisitMinimumLayer(const IConnectableLayer* layer,
325  const char* name = nullptr) = 0;
326 
327  /// Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.
328  /// @param layer - pointer to the layer which is calling back to this visit function.
329  /// @param name - Optional name for the layer.
330  virtual void VisitMultiplicationLayer(const IConnectableLayer* layer,
331  const char* name = nullptr) = 0;
332 
333  /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.
334  /// @param layer - pointer to the layer which is calling back to this visit function.
335  /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
336  /// @param name - Optional name for the layer.
337  virtual void VisitNormalizationLayer(const IConnectableLayer* layer,
338  const NormalizationDescriptor& normalizationDescriptor,
339  const char* name = nullptr) = 0;
340 
341  /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.
342  /// @param layer - pointer to the layer which is calling back to this visit function.
343  /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
344  /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
345  /// @param name - Optional name for the layer.
346  virtual void VisitOutputLayer(const IConnectableLayer* layer,
347  LayerBindingId id,
348  const char* name = nullptr) = 0;
349 
350  /// Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked.
351  /// @param layer - pointer to the layer which is calling back to this visit function.
352  /// @param paddings - n by 2 tensor, where n is the rank of the input tensor,
353  /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and
354  /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
355  /// @param name - Optional name for the layer.
356  virtual void VisitPadLayer(const IConnectableLayer* layer,
357  const PadDescriptor& padDescriptor,
358  const char* name = nullptr) = 0;
359 
360  /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.
361  /// @param layer - pointer to the layer which is calling back to this visit function.
362  /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
363  /// @param name - Optional name for the layer.
364  virtual void VisitPermuteLayer(const IConnectableLayer* layer,
365  const PermuteDescriptor& permuteDescriptor,
366  const char* name = nullptr) = 0;
367 
368  /// Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked.
369  /// @param layer - pointer to the layer which is calling back to this visit function.
370  /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
371  /// @param name - Optional name for the layer.
372  virtual void VisitPooling2dLayer(const IConnectableLayer* layer,
373  const Pooling2dDescriptor& pooling2dDescriptor,
374  const char* name = nullptr) = 0;
375 
376  /// Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
377  /// @param layer - pointer to the layer which is calling back to this visit function.
378  /// @param name - Optional name for the layer.
379  virtual void VisitPreluLayer(const IConnectableLayer* layer,
380  const char* name = nullptr) = 0;
381 
382  /// Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
383  /// @param layer - pointer to the layer which is calling back to this visit function.
384  /// @param name - Optional name for the layer.
385  virtual void VisitQuantizeLayer(const IConnectableLayer* layer,
386  const char* name = nullptr) = 0;
387 
388  /// Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
389  /// @param layer - pointer to the layer which is calling back to this visit function.
390  /// @param descriptor - Parameters controlling the operation of the QLstm operation.
391  /// @param params - The weights and biases for the layer
392  /// @param name - Optional name for the layer.
393  virtual void VisitQLstmLayer(const IConnectableLayer* layer,
394  const QLstmDescriptor& descriptor,
395  const LstmInputParams& params,
396  const char* name = nullptr) = 0;
397 
398  /// Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
399  /// @param layer - pointer to the layer which is calling back to this visit function.
400  /// @param params - The weights and biases for the Quantized LSTM cell
401  /// @param name - Optional name for the layer.
402  virtual void VisitQuantizedLstmLayer(const IConnectableLayer* layer,
403  const QuantizedLstmInputParams& params,
404  const char* name = nullptr) = 0;
405 
406  /// Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked.
407  /// @param layer - pointer to the layer which is calling back to this visit function.
408  /// @param name - Optional name for the layer.
409  virtual void VisitRankLayer(const IConnectableLayer* layer,
410  const char* name = nullptr) = 0;
411 
412  /// Function that a reduce layer should call back to when its Accept(ILayerVisitor&) function is invoked.
413  /// @param layer - pointer to the layer which is calling back to this visit function.
414  /// @param ReduceDescriptor - Parameters for the reduce max operation.
415  /// @param name - Optional name for the layer.
416  virtual void VisitReduceLayer(const IConnectableLayer* layer,
417  const ReduceDescriptor& reduceDescriptor,
418  const char* name = nullptr) = 0;
419 
420  /// Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.
421  /// @param layer - pointer to the layer which is calling back to this visit function.
422  /// @param reshapeDescriptor - Parameters for the reshape operation.
423  /// @param name - Optional name for the layer.
424  virtual void VisitReshapeLayer(const IConnectableLayer* layer,
425  const ReshapeDescriptor& reshapeDescriptor,
426  const char* name = nullptr) = 0;
427 
428  /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.
429  /// @param layer - pointer to the layer which is calling back to this visit function.
430  /// @param resizeDesc - Parameters for the resize operation.
431  /// @param name - Optional name for the layer.
432  ARMNN_DEPRECATED_MSG("Use VisitResizeLayer instead")
433  virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer,
434  const ResizeBilinearDescriptor& resizeDesc,
435  const char* name = nullptr) = 0;
436 
437  /// Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
438  /// @param layer - pointer to the layer which is calling back to this visit function.
439  /// @param resizeDescriptor - Parameters for the resize operation.
440  /// @param name - Optional name for the layer.
441  virtual void VisitResizeLayer(const IConnectableLayer* layer,
442  const ResizeDescriptor& resizeDescriptor,
443  const char* name = nullptr) = 0;
444 
445  /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&)
446  /// function is invoked.
447  /// @param layer - pointer to the layer which is calling back to this visit function.
448  /// @param name - Optional name for the layer.
449  ARMNN_DEPRECATED_MSG("Use VisitElementwiseUnaryLayer instead")
450  virtual void VisitRsqrtLayer(const IConnectableLayer* layer,
451  const char* name = nullptr) = 0;
452 
453  /// Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
454  /// @param layer - pointer to the layer which is calling back to this visit function.
455  /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
456  /// @param name - Optional name for the layer.
457  virtual void VisitSliceLayer(const IConnectableLayer* layer,
458  const SliceDescriptor& sliceDescriptor,
459  const char* name = nullptr) = 0;
460 
461 
462  /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
463  /// @param layer - pointer to the layer which is calling back to this visit function.
464  /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
465  /// @param name - Optional name for the layer.
466  virtual void VisitSoftmaxLayer(const IConnectableLayer* layer,
467  const SoftmaxDescriptor& softmaxDescriptor,
468  const char* name = nullptr) = 0;
469 
470  /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
471  /// @param layer - pointer to the layer which is calling back to this visit function.
472  /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
473  /// @param name - Optional name for the layer.
474  virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer,
475  const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
476  const char* name = nullptr) = 0;
477 
478  /// Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.
479  /// @param layer - pointer to the layer which is calling back to this visit function.
480  /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
481  /// @param name - Optional name for the layer.
482  virtual void VisitSpaceToDepthLayer(const IConnectableLayer* layer,
483  const SpaceToDepthDescriptor& spaceToDepthDescriptor,
484  const char* name = nullptr) = 0;
485 
486  /// Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked.
487  /// @param layer - pointer to the layer which is calling back to this visit function.
488  /// @param splitterDescriptor - ViewsDescriptor to configure the splitting process.
489  /// Number of Views must be equal to the number of outputs,
490  /// and their order must match - e.g. first view corresponds to
491  /// the first output, second view to the second output, etc....
492  /// @param name - Optional name for the layer.
493  virtual void VisitSplitterLayer(const IConnectableLayer* layer,
494  const ViewsDescriptor& splitterDescriptor,
495  const char* name = nullptr) = 0;
496 
497  /// Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.
498  /// @param layer - pointer to the layer which is calling back to this visit function.
499  /// @param stackDescriptor - Parameters for the stack operation.
500  /// @param name - Optional name for the layer.
501  virtual void VisitStackLayer(const IConnectableLayer* layer,
502  const StackDescriptor& stackDescriptor,
503  const char* name = nullptr) = 0;
504 
505  /// Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked
506  /// @param layer - pointer to the layer which is calling back to this visit function.
507  /// @param standInDescriptor - Parameters for the stand-in layer.
508  /// @param name - Optional name for the layer.
509  virtual void VisitStandInLayer(const IConnectableLayer* layer,
510  const StandInDescriptor& standInDescriptor,
511  const char* name = nullptr) = 0;
512 
513  /// Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
514  /// @param layer - pointer to the layer which is calling back to this visit function.
515  /// @param stridedSliceDescriptor - Parameters for the strided slice operation.
516  /// @param name - Optional name for the layer.
517  virtual void VisitStridedSliceLayer(const IConnectableLayer* layer,
518  const StridedSliceDescriptor& stridedSliceDescriptor,
519  const char* name = nullptr) = 0;
520 
521  /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.
522  /// @param layer - pointer to the layer which is calling back to this visit function.
523  /// @param name - Optional name for the layer.
524  virtual void VisitSubtractionLayer(const IConnectableLayer* layer,
525  const char* name = nullptr) = 0;
526 
527  /// Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
528  /// @param layer - pointer to the layer which is calling back to this visit function.
529  /// @param name - Optional name for the layer.
530  virtual void VisitSwitchLayer(const IConnectableLayer* layer,
531  const char* name = nullptr) = 0;
532 
533  /// Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&)
534  /// function is invoked.
535  /// @param layer - pointer to the layer which is calling back to this visit function.
536  /// @param descriptor - Description of the 2D transpose convolution layer.
537  /// @param weights - Tensor for the weights data.
538  /// @param biases - Optional tensor for the bias data.
539  /// @param name - Optional name for the layer.
540  virtual void VisitTransposeConvolution2dLayer(const IConnectableLayer* layer,
541  const TransposeConvolution2dDescriptor& descriptor,
542  const ConstTensor& weights,
543  const Optional<ConstTensor>& biases,
544  const char* name = nullptr) = 0;
545 
546  /// Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked.
547  /// @param layer - pointer to the layer which is calling back to this visit function.
548  /// @param transposeDescriptor - TransposeDescriptor to configure the transpose.
549  /// @param name - Optional name for the layer.
550  virtual void VisitTransposeLayer(const IConnectableLayer* layer,
551  const TransposeDescriptor& transposeDescriptor,
552  const char* name = nullptr) = 0;
553 
554  virtual void StartVisit() {}
555  virtual void FinishVisit() {}
556 
557 };
558 } // namespace armnn
virtual void VisitMergerLayer(const IConnectableLayer *layer, const MergerDescriptor &mergerDescriptor, const char *name=nullptr)=0
Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitQLstmLayer(const IConnectableLayer *layer, const QLstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)=0
Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A ViewsDescriptor for the SplitterLayer.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
virtual void VisitActivationLayer(const IConnectableLayer *layer, const ActivationDescriptor &activationDescriptor, const char *name=nullptr)=0
Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is inv...
A ReshapeDescriptor for the ReshapeLayer.
virtual void VisitSubtractionLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked...
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
Definition: Deprecated.hpp:33
virtual void VisitRankLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A ComparisonDescriptor for the ComparisonLayer.
Definition: Descriptors.hpp:78
virtual void VisitLstmLayer(const IConnectableLayer *layer, const LstmDescriptor &descriptor, const LstmInputParams &params, const char *name=nullptr)=0
Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A Convolution2dDescriptor for the Convolution2dLayer.
virtual void VisitPreluLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function i...
virtual void VisitAdditionLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invok...
virtual void VisitSpaceToDepthLayer(const IConnectableLayer *layer, const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)=0
Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invok...
virtual void VisitQuantizeLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitLogicalBinaryLayer(const IConnectableLayer *layer, const LogicalBinaryDescriptor &logicalBinaryDescriptor, const char *name=nullptr)=0
Function that a logical binary layer should call back to when its Accept(ILayerVisitor&) function is ...
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
virtual void VisitConvolution2dLayer(const IConnectableLayer *layer, const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)=0
Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is ...
Copyright (c) 2021 ARM Limited and Contributors.
virtual void VisitMinimumLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitPooling2dLayer(const IConnectableLayer *layer, const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)=0
Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitElementwiseUnaryLayer(const IConnectableLayer *layer, const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)=0
Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is inv...
virtual void VisitFloorLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitStackLayer(const IConnectableLayer *layer, const StackDescriptor &stackDescriptor, const char *name=nullptr)=0
Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitBatchNormalizationLayer(const IConnectableLayer *layer, const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)=0
Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) functio...
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
virtual void VisitMeanLayer(const IConnectableLayer *layer, const MeanDescriptor &meanDescriptor, const char *name=nullptr)=0
Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitPermuteLayer(const IConnectableLayer *layer, const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)=0
Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitMultiplicationLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is ...
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:210
A ResizeDescriptor for the ResizeLayer.
A StackDescriptor for the StackLayer.
virtual void VisitSwitchLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitMergeLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A PadDescriptor for the PadLayer.
virtual void VisitStridedSliceLayer(const IConnectableLayer *layer, const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)=0
Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoke...
virtual void VisitFullyConnectedLayer(const IConnectableLayer *layer, const FullyConnectedDescriptor &fullyConnectedDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)=0
Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is...
virtual void VisitSliceLayer(const IConnectableLayer *layer, const SliceDescriptor &sliceDescriptor, const char *name=nullptr)=0
Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitResizeBilinearLayer(const IConnectableLayer *layer, const ResizeBilinearDescriptor &resizeDesc, const char *name=nullptr)=0
Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is...
An LstmDescriptor for the LstmLayer.
#define ARMNN_NO_DEPRECATE_WARN_END
Definition: Deprecated.hpp:34
virtual void VisitConstantLayer(const IConnectableLayer *layer, const ConstTensor &input, const char *name=nullptr)=0
Function a layer with no inputs and a single output, which always corresponds to the passed in consta...
A L2NormalizationDescriptor for the L2NormalizationLayer.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
Definition: Descriptors.hpp:56
virtual void VisitLogSoftmaxLayer(const IConnectableLayer *layer, const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)=0
Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is inv...
An OriginsDescriptor for the ConcatLayer.
A ReduceDescriptor for the REDUCE operators.
virtual void VisitReduceLayer(const IConnectableLayer *layer, const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)=0
Function that a reduce layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A FullyConnectedDescriptor for the FullyConnectedLayer.
virtual void VisitFillLayer(const IConnectableLayer *layer, const FillDescriptor &fillDescriptor, const char *name=nullptr)=0
Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:314
A GatherDescriptor for the GatherLayer.
virtual void VisitDepthwiseConvolution2dLayer(const IConnectableLayer *layer, const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)=0
Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayer...
A StandInDescriptor for the StandIn layer.
A QLstmDescriptor for the QLstmLayer.
virtual void VisitGreaterLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked...
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:25
virtual void VisitTransposeLayer(const IConnectableLayer *layer, const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)=0
Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invok...
virtual void VisitDepthToSpaceLayer(const IConnectableLayer *layer, const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)=0
Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invok...
A SliceDescriptor for the SliceLayer.
virtual void VisitResizeLayer(const IConnectableLayer *layer, const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)=0
Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitBatchToSpaceNdLayer(const IConnectableLayer *layer, const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)=0
Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function ...
virtual void VisitQuantizedLstmLayer(const IConnectableLayer *layer, const QuantizedLstmInputParams &params, const char *name=nullptr)=0
Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoke...
virtual void VisitStandInLayer(const IConnectableLayer *layer, const StandInDescriptor &standInDescriptor, const char *name=nullptr)=0
Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked...
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
virtual void VisitConcatLayer(const IConnectableLayer *layer, const OriginsDescriptor &concatDescriptor, const char *name=nullptr)
Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked...
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
Definition: Descriptors.hpp:98
virtual void VisitOutputLayer(const IConnectableLayer *layer, LayerBindingId id, const char *name=nullptr)=0
Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitEqualLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitSplitterLayer(const IConnectableLayer *layer, const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)=0
Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoke...
virtual void VisitTransposeConvolution2dLayer(const IConnectableLayer *layer, const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)=0
Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) fu...
virtual void StartVisit()
virtual void VisitNormalizationLayer(const IConnectableLayer *layer, const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)=0
Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is i...
virtual void VisitSoftmaxLayer(const IConnectableLayer *layer, const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)=0
Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitReshapeLayer(const IConnectableLayer *layer, const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)=0
Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitInputLayer(const IConnectableLayer *layer, LayerBindingId id, const char *name=nullptr)=0
Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked...
A MeanDescriptor for the MeanLayer.
virtual void VisitDequantizeLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function that a Dequantize layer should call back to when its Accept(ILayerVisitor&) function is invo...
A TransposeDescriptor for the TransposeLayer.
A StridedSliceDescriptor for the StridedSliceLayer.
virtual void VisitDivisionLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked...
#define ARMNN_DEPRECATED_MSG(message)
Definition: Deprecated.hpp:43
virtual void VisitGatherLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitComparisonLayer(const IConnectableLayer *layer, const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)=0
Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer *layer, const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)=0
Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invok...
A Pooling2dDescriptor for the Pooling2dLayer.
virtual void VisitL2NormalizationLayer(const IConnectableLayer *layer, const L2NormalizationDescriptor &desc, const char *name=nullptr)=0
Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) function ...
A NormalizationDescriptor for the NormalizationLayer.
virtual void VisitAbsLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function an absolute layer should call back to when its Accept(ILayerVisitor&) function is invoked...
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
virtual void VisitDetectionPostProcessLayer(const IConnectableLayer *layer, const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)=0
Function that a Detection PostProcess layer should call back to when its Accept(ILayerVisitor&) funct...
virtual void VisitRsqrtLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) functi...
A SoftmaxDescriptor for the SoftmaxLayer.
virtual void VisitArgMinMaxLayer(const IConnectableLayer *layer, const ArgMinMaxDescriptor &argMinMaxDescriptor, const char *name=nullptr)=0
Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is in...
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A FillDescriptor for the FillLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
virtual void VisitPadLayer(const IConnectableLayer *layer, const PadDescriptor &padDescriptor, const char *name=nullptr)=0
Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitMaximumLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked...
virtual void VisitInstanceNormalizationLayer(const IConnectableLayer *layer, const InstanceNormalizationDescriptor &desc, const char *name=nullptr)=0
Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) fun...
A PermuteDescriptor for the PermuteLayer.
virtual void FinishVisit()
std::vector< float > anchors({ 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 100.5f, 1.0f, 1.0f })