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