ArmNN
 21.08
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 
202  /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&)
203  /// function is invoked.
204  /// @param layer - pointer to the layer which is calling back to this visit function.
205  /// @param fullyConnectedDescriptor - Description of the fully connected layer.
206  /// @param name - Optional name for the layer.
207  virtual void VisitFullyConnectedLayer(const IConnectableLayer* layer,
208  const FullyConnectedDescriptor& fullyConnectedDescriptor,
209  const char* name = nullptr) = 0;
210 
211  /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&)
212  /// function is invoked.
213  /// @param layer - pointer to the layer which is calling back to this visit function.
214  /// @param fullyConnectedDescriptor - Description of the fully connected layer.
215  /// @param weights - Tensor for the weights data.
216  /// @param biases - Optional tensor for the bias data.
217  /// @param name - Optional name for the layer.
218  ARMNN_DEPRECATED_MSG("Use VisitFullyConnectedLayer without ConstTensors")
219  virtual void VisitFullyConnectedLayer(const IConnectableLayer* layer,
220  const FullyConnectedDescriptor& fullyConnectedDescriptor,
221  const ConstTensor& weights,
222  const Optional<ConstTensor>& biases,
223  const char* name = nullptr) = 0;
224 
225  /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
226  /// @param layer - pointer to the layer which is calling back to this visit function.
227  /// @param name - Optional name for the layer.
228  ARMNN_DEPRECATED_MSG("Use VisitGatherLayer with descriptor instead")
229  virtual void VisitGatherLayer(const IConnectableLayer* layer,
230  const char* name = nullptr) = 0;
231 
232  /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
233  /// @param layer - pointer to the layer which is calling back to this visit function.
234  /// @param gatherDescriptor - Parameters for the gather operation.
235  /// @param name - Optional name for the layer.
236  virtual void VisitGatherLayer(const IConnectableLayer* layer,
237  const GatherDescriptor& gatherDescriptor,
238  const char* name = nullptr) = 0;
239 
240  /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked.
241  /// @param layer - pointer to the layer which is calling back to this visit function.
242  /// @param name - Optional name for the layer.
243  ARMNN_DEPRECATED_MSG("Use VisitComparisonLayer instead")
244  virtual void VisitGreaterLayer(const IConnectableLayer* layer,
245  const char* name = nullptr) = 0;
246 
247  /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.
248  /// @param layer - pointer to the layer which is calling back to this visit function.
249  /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified
250  /// when passing the inputs to the IRuntime::EnqueueWorkload() function.
251  /// @param name - Optional name for the layer.
252  virtual void VisitInputLayer(const IConnectableLayer* layer,
253  LayerBindingId id,
254  const char* name = nullptr) = 0;
255 
256  /// Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&)
257  /// function is invoked.
258  /// @param layer - pointer to the layer which is calling back to this visit function.
259  /// @param desc - Parameters for the instance normalization operation.
260  /// @param name - Optional name for the layer.
261  virtual void VisitInstanceNormalizationLayer(const IConnectableLayer* layer,
263  const char* name = nullptr) = 0;
264 
265  /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&)
266  /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input.
267  /// @param layer - pointer to the layer which is calling back to this visit function.
268  /// @param desc - Parameters for the L2 normalization operation.
269  /// @param name - Optional name for the layer.
270  virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer,
271  const L2NormalizationDescriptor& desc,
272  const char* name = nullptr) = 0;
273 
274  /// Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
275  /// @param layer - pointer to the layer which is calling back to this visit function.
276  /// @param logSoftmaxDescriptor - LogSoftmaxDescriptor to configure the log softmax.
277  /// @param name - Optional name for the layer.
278  virtual void VisitLogSoftmaxLayer(const IConnectableLayer* layer,
279  const LogSoftmaxDescriptor& logSoftmaxDescriptor,
280  const char* name = nullptr) = 0;
281 
282  /// Function that a logical binary layer should call back to when its Accept(ILayerVisitor&) function is invoked.
283  /// @param layer - pointer to the layer which is calling back to this visit function.
284  /// @param logicalBinaryDescriptor - LogicalBinaryDescriptor to configure the logical unary layer.
285  /// @param name - Optional name for the layer.
286  virtual void VisitLogicalBinaryLayer(const IConnectableLayer* layer,
287  const LogicalBinaryDescriptor& logicalBinaryDescriptor,
288  const char* name = nullptr) = 0;
289 
290  /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
291  /// @param layer - pointer to the layer which is calling back to this visit function.
292  /// @param descriptor - Parameters controlling the operation of the Lstm operation.
293  /// @param params - The weights and biases for the LSTM cell.
294  /// @param name - Optional name for the layer.
295  virtual void VisitLstmLayer(const IConnectableLayer* layer,
296  const LstmDescriptor& descriptor,
297  const LstmInputParams& params,
298  const char* name = nullptr) = 0;
299 
300  /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
301  /// @param layer - pointer to the layer which is calling back to this visit function.
302  /// @param name - Optional name for the layer.
303  virtual void VisitMaximumLayer(const IConnectableLayer* layer,
304  const char* name = nullptr) = 0;
305 
306  /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.
307  /// @param layer - pointer to the layer which is calling back to this visit function.
308  /// @param meanDescriptor - Parameters for the mean operation.
309  /// @param name - Optional name for the layer.
310  virtual void VisitMeanLayer(const IConnectableLayer* layer,
311  const MeanDescriptor& meanDescriptor,
312  const char* name = nullptr) = 0;
313 
314  /// Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked.
315  /// @param layer - pointer to the layer which is calling back to this visit function.
316  /// @param name - Optional name for the layer.
317  virtual void VisitMergeLayer(const IConnectableLayer* layer,
318  const char* name = nullptr) = 0;
319 
320  /// Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked.
321  /// @param layer - pointer to the layer which is calling back to this visit function.
322  /// @param mergerDescriptor - MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation
323  /// process. Number of Views must be equal to the number of inputs, and their order
324  /// must match - e.g. first view corresponds to the first input, second view to the
325  /// second input, etc....
326  /// @param name - Optional name for the layer.
327  ARMNN_DEPRECATED_MSG("Use VisitConcatLayer instead")
328  virtual void VisitMergerLayer(const IConnectableLayer* layer,
329  const MergerDescriptor& mergerDescriptor,
330  const char* name = nullptr) = 0;
331 
332  /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
333  /// @param layer - pointer to the layer which is calling back to this visit function.
334  /// @param name - Optional name for the layer.
335  virtual void VisitMinimumLayer(const IConnectableLayer* layer,
336  const char* name = nullptr) = 0;
337 
338  /// Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.
339  /// @param layer - pointer to the layer which is calling back to this visit function.
340  /// @param name - Optional name for the layer.
341  virtual void VisitMultiplicationLayer(const IConnectableLayer* layer,
342  const char* name = nullptr) = 0;
343 
344  /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.
345  /// @param layer - pointer to the layer which is calling back to this visit function.
346  /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
347  /// @param name - Optional name for the layer.
348  virtual void VisitNormalizationLayer(const IConnectableLayer* layer,
349  const NormalizationDescriptor& normalizationDescriptor,
350  const char* name = nullptr) = 0;
351 
352  /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.
353  /// @param layer - pointer to the layer which is calling back to this visit function.
354  /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
355  /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
356  /// @param name - Optional name for the layer.
357  virtual void VisitOutputLayer(const IConnectableLayer* layer,
358  LayerBindingId id,
359  const char* name = nullptr) = 0;
360 
361  /// Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked.
362  /// @param layer - pointer to the layer which is calling back to this visit function.
363  /// @param paddings - n by 2 tensor, where n is the rank of the input tensor,
364  /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and
365  /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
366  /// @param name - Optional name for the layer.
367  virtual void VisitPadLayer(const IConnectableLayer* layer,
368  const PadDescriptor& padDescriptor,
369  const char* name = nullptr) = 0;
370 
371  /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.
372  /// @param layer - pointer to the layer which is calling back to this visit function.
373  /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
374  /// @param name - Optional name for the layer.
375  virtual void VisitPermuteLayer(const IConnectableLayer* layer,
376  const PermuteDescriptor& permuteDescriptor,
377  const char* name = nullptr) = 0;
378 
379  /// Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked.
380  /// @param layer - pointer to the layer which is calling back to this visit function.
381  /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
382  /// @param name - Optional name for the layer.
383  virtual void VisitPooling2dLayer(const IConnectableLayer* layer,
384  const Pooling2dDescriptor& pooling2dDescriptor,
385  const char* name = nullptr) = 0;
386 
387  /// Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
388  /// @param layer - pointer to the layer which is calling back to this visit function.
389  /// @param name - Optional name for the layer.
390  virtual void VisitPreluLayer(const IConnectableLayer* layer,
391  const char* name = nullptr) = 0;
392 
393  /// Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
394  /// @param layer - pointer to the layer which is calling back to this visit function.
395  /// @param name - Optional name for the layer.
396  virtual void VisitQuantizeLayer(const IConnectableLayer* layer,
397  const char* name = nullptr) = 0;
398 
399  /// Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
400  /// @param layer - pointer to the layer which is calling back to this visit function.
401  /// @param descriptor - Parameters controlling the operation of the QLstm operation.
402  /// @param params - The weights and biases for the layer
403  /// @param name - Optional name for the layer.
404  virtual void VisitQLstmLayer(const IConnectableLayer* layer,
405  const QLstmDescriptor& descriptor,
406  const LstmInputParams& params,
407  const char* name = nullptr) = 0;
408 
409  /// Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
410  /// @param layer - pointer to the layer which is calling back to this visit function.
411  /// @param params - The weights and biases for the Quantized LSTM cell
412  /// @param name - Optional name for the layer.
413  virtual void VisitQuantizedLstmLayer(const IConnectableLayer* layer,
414  const QuantizedLstmInputParams& params,
415  const char* name = nullptr) = 0;
416 
417  /// Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked.
418  /// @param layer - pointer to the layer which is calling back to this visit function.
419  /// @param name - Optional name for the layer.
420  virtual void VisitRankLayer(const IConnectableLayer* layer,
421  const char* name = nullptr) = 0;
422 
423  /// Function that a reduce layer should call back to when its Accept(ILayerVisitor&) function is invoked.
424  /// @param layer - pointer to the layer which is calling back to this visit function.
425  /// @param ReduceDescriptor - Parameters for the reduce max operation.
426  /// @param name - Optional name for the layer.
427  virtual void VisitReduceLayer(const IConnectableLayer* layer,
428  const ReduceDescriptor& reduceDescriptor,
429  const char* name = nullptr) = 0;
430 
431  /// Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.
432  /// @param layer - pointer to the layer which is calling back to this visit function.
433  /// @param reshapeDescriptor - Parameters for the reshape operation.
434  /// @param name - Optional name for the layer.
435  virtual void VisitReshapeLayer(const IConnectableLayer* layer,
436  const ReshapeDescriptor& reshapeDescriptor,
437  const char* name = nullptr) = 0;
438 
439  /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.
440  /// @param layer - pointer to the layer which is calling back to this visit function.
441  /// @param resizeDesc - Parameters for the resize operation.
442  /// @param name - Optional name for the layer.
443  ARMNN_DEPRECATED_MSG("Use VisitResizeLayer instead")
444  virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer,
445  const ResizeBilinearDescriptor& resizeDesc,
446  const char* name = nullptr) = 0;
447 
448  /// Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
449  /// @param layer - pointer to the layer which is calling back to this visit function.
450  /// @param resizeDescriptor - Parameters for the resize operation.
451  /// @param name - Optional name for the layer.
452  virtual void VisitResizeLayer(const IConnectableLayer* layer,
453  const ResizeDescriptor& resizeDescriptor,
454  const char* name = nullptr) = 0;
455 
456  /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&)
457  /// function is invoked.
458  /// @param layer - pointer to the layer which is calling back to this visit function.
459  /// @param name - Optional name for the layer.
460  ARMNN_DEPRECATED_MSG("Use VisitElementwiseUnaryLayer instead")
461  virtual void VisitRsqrtLayer(const IConnectableLayer* layer,
462  const char* name = nullptr) = 0;
463 
464  /// Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
465  /// @param layer - pointer to the layer which is calling back to this visit function.
466  /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
467  /// @param name - Optional name for the layer.
468  virtual void VisitSliceLayer(const IConnectableLayer* layer,
469  const SliceDescriptor& sliceDescriptor,
470  const char* name = nullptr) = 0;
471 
472 
473  /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
474  /// @param layer - pointer to the layer which is calling back to this visit function.
475  /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
476  /// @param name - Optional name for the layer.
477  virtual void VisitSoftmaxLayer(const IConnectableLayer* layer,
478  const SoftmaxDescriptor& softmaxDescriptor,
479  const char* name = nullptr) = 0;
480 
481  /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
482  /// @param layer - pointer to the layer which is calling back to this visit function.
483  /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
484  /// @param name - Optional name for the layer.
485  virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer,
486  const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
487  const char* name = nullptr) = 0;
488 
489  /// Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.
490  /// @param layer - pointer to the layer which is calling back to this visit function.
491  /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
492  /// @param name - Optional name for the layer.
493  virtual void VisitSpaceToDepthLayer(const IConnectableLayer* layer,
494  const SpaceToDepthDescriptor& spaceToDepthDescriptor,
495  const char* name = nullptr) = 0;
496 
497  /// Function that a splitter 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 splitterDescriptor - ViewsDescriptor to configure the splitting process.
500  /// Number of Views must be equal to the number of outputs,
501  /// and their order must match - e.g. first view corresponds to
502  /// the first output, second view to the second output, etc....
503  /// @param name - Optional name for the layer.
504  virtual void VisitSplitterLayer(const IConnectableLayer* layer,
505  const ViewsDescriptor& splitterDescriptor,
506  const char* name = nullptr) = 0;
507 
508  /// Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.
509  /// @param layer - pointer to the layer which is calling back to this visit function.
510  /// @param stackDescriptor - Parameters for the stack operation.
511  /// @param name - Optional name for the layer.
512  virtual void VisitStackLayer(const IConnectableLayer* layer,
513  const StackDescriptor& stackDescriptor,
514  const char* name = nullptr) = 0;
515 
516  /// Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked
517  /// @param layer - pointer to the layer which is calling back to this visit function.
518  /// @param standInDescriptor - Parameters for the stand-in layer.
519  /// @param name - Optional name for the layer.
520  virtual void VisitStandInLayer(const IConnectableLayer* layer,
521  const StandInDescriptor& standInDescriptor,
522  const char* name = nullptr) = 0;
523 
524  /// Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
525  /// @param layer - pointer to the layer which is calling back to this visit function.
526  /// @param stridedSliceDescriptor - Parameters for the strided slice operation.
527  /// @param name - Optional name for the layer.
528  virtual void VisitStridedSliceLayer(const IConnectableLayer* layer,
529  const StridedSliceDescriptor& stridedSliceDescriptor,
530  const char* name = nullptr) = 0;
531 
532  /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.
533  /// @param layer - pointer to the layer which is calling back to this visit function.
534  /// @param name - Optional name for the layer.
535  virtual void VisitSubtractionLayer(const IConnectableLayer* layer,
536  const char* name = nullptr) = 0;
537 
538  /// Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
539  /// @param layer - pointer to the layer which is calling back to this visit function.
540  /// @param name - Optional name for the layer.
541  virtual void VisitSwitchLayer(const IConnectableLayer* layer,
542  const char* name = nullptr) = 0;
543 
544  /// Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&)
545  /// function is invoked.
546  /// @param layer - pointer to the layer which is calling back to this visit function.
547  /// @param descriptor - Description of the 2D transpose convolution layer.
548  /// @param weights - Tensor for the weights data.
549  /// @param biases - Optional tensor for the bias data.
550  /// @param name - Optional name for the layer.
551  virtual void VisitTransposeConvolution2dLayer(const IConnectableLayer* layer,
552  const TransposeConvolution2dDescriptor& descriptor,
553  const ConstTensor& weights,
554  const Optional<ConstTensor>& biases,
555  const char* name = nullptr) = 0;
556 
557  /// Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked.
558  /// @param layer - pointer to the layer which is calling back to this visit function.
559  /// @param transposeDescriptor - TransposeDescriptor to configure the transpose.
560  /// @param name - Optional name for the layer.
561  virtual void VisitTransposeLayer(const IConnectableLayer* layer,
562  const TransposeDescriptor& transposeDescriptor,
563  const char* name = nullptr) = 0;
564 
565  virtual void StartVisit() {}
566  virtual void FinishVisit() {}
567 
568 };
569 } // 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:61
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:244
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 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:327
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 VisitFullyConnectedLayer(const IConnectableLayer *layer, const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)=0
Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is...
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()