blob: 6c0977303c1b9782c5489b1b43a8bc24d5e517f5 [file] [log] [blame]
jimfly015f4e41f2019-01-23 16:10:17 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5#pragma once
6
Jim Flynne242f2d2019-05-22 14:24:13 +01007#include <armnn/Deprecated.hpp>
jimfly015f4e41f2019-01-23 16:10:17 +00008#include <armnn/DescriptorsFwd.hpp>
Matthew Bentham313e1c82019-03-25 17:37:47 +00009#include <armnn/NetworkFwd.hpp>
Aron Virginas-Tar00859782019-02-11 12:21:27 +000010#include <armnn/Optional.hpp>
jimfly015f4e41f2019-01-23 16:10:17 +000011#include <armnn/TensorFwd.hpp>
12#include <armnn/Types.hpp>
13
14namespace armnn
15{
16class ILayerVisitor
17{
jimfly01e9e7bfd2019-01-24 22:29:33 +000018protected:
19 ILayerVisitor() {}
20 virtual ~ILayerVisitor() {}
21
jimfly015f4e41f2019-01-23 16:10:17 +000022public:
Kevin May868eb142019-09-04 17:29:31 +010023 /// 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 virtual void VisitAbsLayer(const IConnectableLayer* layer,
28 const char* name = nullptr) = 0;
29
Derek Lamberti61f54632019-03-25 16:28:44 +000030 /// Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +000031 /// @param layer - pointer to the layer which is calling back to this visit function.
Derek Lamberti61f54632019-03-25 16:28:44 +000032 /// @param activationDescriptor - ActivationDescriptor to configure the activation.
jimfly015f4e41f2019-01-23 16:10:17 +000033 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +000034 virtual void VisitActivationLayer(const IConnectableLayer* layer,
35 const ActivationDescriptor& activationDescriptor,
36 const char* name = nullptr) = 0;
37
38 /// Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked.
39 /// @param layer - pointer to the layer which is calling back to this visit function.
40 /// @param name - Optional name for the layer.
41 virtual void VisitAdditionLayer(const IConnectableLayer* layer,
42 const char* name = nullptr) = 0;
43
Nikhil Rajee391d52019-09-05 17:50:44 +010044 /// Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked.
45 /// @param layer - pointer to the layer which is calling back to this visit function.
46 /// @param argMinMaxDescriptor - ArgMinMaxDescriptor to configure the activation.
47 /// @param name - Optional name for the layer.
48 virtual void VisitArgMinMaxLayer(const IConnectableLayer* layer,
49 const ArgMinMaxDescriptor& argMinMaxDescriptor,
50 const char* name = nullptr) = 0;
51
Derek Lamberti61f54632019-03-25 16:28:44 +000052 /// Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&)
53 /// function is invoked.
54 /// @param layer - pointer to the layer which is calling back to this visit function.
55 /// @param mean - Pre-calculated mean for each channel.
56 /// @param variance - Pre-calculated variance for each channel.
57 /// @param beta - Per-channel additive factor.
58 /// @param gamma - Per-channel multiplicative factor.
59 /// @param name - Optional name for the layer.
60 virtual void VisitBatchNormalizationLayer(const IConnectableLayer* layer,
61 const BatchNormalizationDescriptor& desc,
62 const ConstTensor& mean,
63 const ConstTensor& variance,
64 const ConstTensor& beta,
65 const ConstTensor& gamma,
66 const char* name = nullptr) = 0;
67
68 /// Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&)
69 /// function is invoked.
70 /// @param layer - pointer to the layer which is calling back to this visit function.
71 /// @param batchToSpaceNdDescriptor - Description of the layer.
72 /// @param name - Optional name for the layer.
73 virtual void VisitBatchToSpaceNdLayer(const IConnectableLayer* layer,
74 const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor,
75 const char* name = nullptr) = 0;
76
Jim Flynn906f9462019-05-10 13:55:21 +010077 /// Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked.
78 /// @param layer - pointer to the layer which is calling back to this visit function.
Jim Flynne242f2d2019-05-22 14:24:13 +010079 /// @param concatDescriptor - ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation
80 /// process. Number of Views must be equal to the number of inputs, and their order
81 /// must match - e.g. first view corresponds to the first input, second view to the
82 /// second input, etc....
Jim Flynn906f9462019-05-10 13:55:21 +010083 /// @param name - Optional name for the layer.
84 virtual void VisitConcatLayer(const IConnectableLayer* layer,
Jim Flynne242f2d2019-05-22 14:24:13 +010085 const OriginsDescriptor& concatDescriptor,
Jim Flynn906f9462019-05-10 13:55:21 +010086 const char* name = nullptr)
87 {
88 // default implementation to ease transition while MergerLayer is being deprecated
Jim Flynne242f2d2019-05-22 14:24:13 +010089 ARMNN_NO_DEPRECATE_WARN_BEGIN
90 VisitMergerLayer(layer, concatDescriptor, name);
91 ARMNN_NO_DEPRECATE_WARN_END
Jim Flynn906f9462019-05-10 13:55:21 +010092 }
93
Derek Lamberti61f54632019-03-25 16:28:44 +000094 /// Function a layer with no inputs and a single output, which always corresponds to
95 /// the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked.
96 /// @param layer - pointer to the layer which is calling back to this visit function.
97 /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain
98 /// its own copy of the tensor data, meaning the memory referenced by @a input can
99 /// be freed or reused after this function is called.
100 /// @param name - Optional name for the layer.
101 virtual void VisitConstantLayer(const IConnectableLayer* layer,
102 const ConstTensor& input,
103 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000104
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000105 /// Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&)
jimfly015f4e41f2019-01-23 16:10:17 +0000106 /// function is invoked.
107 /// @param layer - pointer to the layer which is calling back to this visit function.
108 /// @param convolution2dDescriptor - Description of the 2D convolution layer.
109 /// @param weights - Tensor for the weights data.
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000110 /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
jimfly015f4e41f2019-01-23 16:10:17 +0000111 /// @param name - Optional name for the layer.
112 virtual void VisitConvolution2dLayer(const IConnectableLayer* layer,
113 const Convolution2dDescriptor& convolution2dDescriptor,
114 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000115 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000116 const char* name = nullptr) = 0;
117
jimfly015f4e41f2019-01-23 16:10:17 +0000118 /// Function that a 2D depthwise convolution layer with biases should call back to when its
119 /// Accept(ILayerVisitor&) function is invoked.
120 /// @param layer - pointer to the layer which is calling back to this visit function.
121 /// @param convolution2dDescriptor - Description of the 2D depthwise convolution layer.
122 /// @param weights - Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000123 /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
jimfly015f4e41f2019-01-23 16:10:17 +0000124 /// @param name - Optional name for the layer.
125 virtual void VisitDepthwiseConvolution2dLayer(const IConnectableLayer* layer,
126 const DepthwiseConvolution2dDescriptor& convolution2dDescriptor,
127 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000128 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000129 const char* name = nullptr) = 0;
130
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000131 /// Function that a Dequantize layer should call back to when its
132 /// Accept(ILayerVisitor&) function is invoked.
133 /// @param layer - pointer to the layer which is calling back to this visit function.
134 /// @param name - Optional name for the layer.
135 virtual void VisitDequantizeLayer(const IConnectableLayer* layer,
136 const char* name = nullptr) = 0;
137
jimfly01d161ba02019-01-28 12:51:53 +0000138 /// Function that a Detection PostProcess layer should call back to when its
139 /// Accept(ILayerVisitor&) function is invoked.
140 /// @param layer - pointer to the layer which is calling back to this visit function.
141 /// @param descriptor - Description of the Detection PostProcess layer.
Narumol Prangnawarat6d302bf2019-02-04 11:46:26 +0000142 /// @param anchors - Tensor for the anchors.
jimfly01d161ba02019-01-28 12:51:53 +0000143 /// @param name - Optional name for the layer.
144 virtual void VisitDetectionPostProcessLayer(const IConnectableLayer* layer,
145 const DetectionPostProcessDescriptor& descriptor,
Narumol Prangnawarat6d302bf2019-02-04 11:46:26 +0000146 const ConstTensor& anchors,
jimfly01d161ba02019-01-28 12:51:53 +0000147 const char* name = nullptr) = 0;
148
Derek Lamberti61f54632019-03-25 16:28:44 +0000149 /// Function a division layer should call back to when its 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 VisitDivisionLayer(const IConnectableLayer* layer,
153 const char* name = nullptr) = 0;
154
155 /// Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked.
156 /// @param layer - pointer to the layer which is calling back to this visit function.
157 /// @param name - Optional name for the layer.
158 virtual void VisitEqualLayer(const IConnectableLayer* layer,
159 const char* name = nullptr) = 0;
160
161 /// Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked.
162 /// @param layer - pointer to the layer which is calling back to this visit function.
163 /// @param name - Optional name for the layer.
164 virtual void VisitFloorLayer(const IConnectableLayer* layer,
165 const char* name = nullptr) = 0;
166
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000167 /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&)
jimfly015f4e41f2019-01-23 16:10:17 +0000168 /// function is invoked.
169 /// @param layer - pointer to the layer which is calling back to this visit function.
170 /// @param fullyConnectedDescriptor - Description of the fully connected layer.
171 /// @param weights - Tensor for the weights data.
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000172 /// @param biases - Optional tensor for the bias data.
jimfly015f4e41f2019-01-23 16:10:17 +0000173 /// @param name - Optional name for the layer.
174 virtual void VisitFullyConnectedLayer(const IConnectableLayer* layer,
175 const FullyConnectedDescriptor& fullyConnectedDescriptor,
176 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000177 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000178 const char* name = nullptr) = 0;
179
Derek Lamberti61f54632019-03-25 16:28:44 +0000180 /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000181 /// @param layer - pointer to the layer which is calling back to this visit function.
jimfly015f4e41f2019-01-23 16:10:17 +0000182 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000183 virtual void VisitGatherLayer(const IConnectableLayer* layer,
jimfly015f4e41f2019-01-23 16:10:17 +0000184 const char* name = nullptr) = 0;
185
Derek Lamberti61f54632019-03-25 16:28:44 +0000186 /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000187 /// @param layer - pointer to the layer which is calling back to this visit function.
188 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000189 virtual void VisitGreaterLayer(const IConnectableLayer* layer,
190 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000191
Derek Lamberti61f54632019-03-25 16:28:44 +0000192 /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000193 /// @param layer - pointer to the layer which is calling back to this visit function.
Derek Lamberti61f54632019-03-25 16:28:44 +0000194 /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified
195 /// when passing the inputs to the IRuntime::EnqueueWorkload() function.
jimfly015f4e41f2019-01-23 16:10:17 +0000196 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000197 virtual void VisitInputLayer(const IConnectableLayer* layer,
198 LayerBindingId id,
199 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000200
jimfly015f4e41f2019-01-23 16:10:17 +0000201
202 /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&)
203 /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input.
204 /// @param layer - pointer to the layer which is calling back to this visit function.
205 /// @param desc - Parameters for the L2 normalization operation.
206 /// @param name - Optional name for the layer.
207 virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer,
208 const L2NormalizationDescriptor& desc,
209 const char* name = nullptr) = 0;
210
jimfly015f4e41f2019-01-23 16:10:17 +0000211 /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
212 /// @param layer - pointer to the layer which is calling back to this visit function.
213 /// @param descriptor - Parameters controlling the operation of the Lstm operation.
214 /// @param params - The weights and biases for the LSTM cell.
215 /// @param name - Optional name for the layer.
216 virtual void VisitLstmLayer(const IConnectableLayer* layer,
217 const LstmDescriptor& descriptor,
218 const LstmInputParams& params,
219 const char* name = nullptr) = 0;
220
jimfly015f4e41f2019-01-23 16:10:17 +0000221 /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
222 /// @param layer - pointer to the layer which is calling back to this visit function.
223 /// @param name - Optional name for the layer.
224 virtual void VisitMaximumLayer(const IConnectableLayer* layer,
225 const char* name = nullptr) = 0;
226
227 /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.
228 /// @param layer - pointer to the layer which is calling back to this visit function.
229 /// @param meanDescriptor - Parameters for the mean operation.
230 /// @param name - Optional name for the layer.
231 virtual void VisitMeanLayer(const IConnectableLayer* layer,
232 const MeanDescriptor& meanDescriptor,
233 const char* name = nullptr) = 0;
234
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100235 /// Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked.
236 /// @param layer - pointer to the layer which is calling back to this visit function.
237 /// @param name - Optional name for the layer.
238 virtual void VisitMergeLayer(const IConnectableLayer* layer,
239 const char* name = nullptr) = 0;
240
Derek Lamberti61f54632019-03-25 16:28:44 +0000241 /// Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked.
242 /// @param layer - pointer to the layer which is calling back to this visit function.
Jim Flynne242f2d2019-05-22 14:24:13 +0100243 /// @param mergerDescriptor - MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation
244 /// process. Number of Views must be equal to the number of inputs, and their order
245 /// must match - e.g. first view corresponds to the first input, second view to the
246 /// second input, etc....
Derek Lamberti61f54632019-03-25 16:28:44 +0000247 /// @param name - Optional name for the layer.
Jim Flynne242f2d2019-05-22 14:24:13 +0100248 ARMNN_DEPRECATED_MSG("Use VisitConcatLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000249 virtual void VisitMergerLayer(const IConnectableLayer* layer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100250 const MergerDescriptor& mergerDescriptor,
Derek Lamberti61f54632019-03-25 16:28:44 +0000251 const char* name = nullptr) = 0;
252
253 /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
254 /// @param layer - pointer to the layer which is calling back to this visit function.
255 /// @param name - Optional name for the layer.
256 virtual void VisitMinimumLayer(const IConnectableLayer* layer,
257 const char* name = nullptr) = 0;
258
259 /// Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.
260 /// @param layer - pointer to the layer which is calling back to this visit function.
261 /// @param name - Optional name for the layer.
262 virtual void VisitMultiplicationLayer(const IConnectableLayer* layer,
263 const char* name = nullptr) = 0;
264
265 /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.
266 /// @param layer - pointer to the layer which is calling back to this visit function.
267 /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
268 /// @param name - Optional name for the layer.
269 virtual void VisitNormalizationLayer(const IConnectableLayer* layer,
270 const NormalizationDescriptor& normalizationDescriptor,
271 const char* name = nullptr) = 0;
272
273 /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.
274 /// @param layer - pointer to the layer which is calling back to this visit function.
275 /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
276 /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
277 /// @param name - Optional name for the layer.
278 virtual void VisitOutputLayer(const IConnectableLayer* layer,
279 LayerBindingId id,
280 const char* name = nullptr) = 0;
281
jimfly015f4e41f2019-01-23 16:10:17 +0000282 /// Function a pad 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 paddings - n by 2 tensor, where n is the rank of the input tensor,
285 /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and
286 /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
287 /// @param name - Optional name for the layer.
288 virtual void VisitPadLayer(const IConnectableLayer* layer,
289 const PadDescriptor& padDescriptor,
290 const char* name = nullptr) = 0;
291
Derek Lamberti61f54632019-03-25 16:28:44 +0000292 /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.
293 /// @param layer - pointer to the layer which is calling back to this visit function.
294 /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
295 /// @param name - Optional name for the layer.
296 virtual void VisitPermuteLayer(const IConnectableLayer* layer,
297 const PermuteDescriptor& permuteDescriptor,
298 const char* name = nullptr) = 0;
299
300 /// Function that a pooling 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 pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
303 /// @param name - Optional name for the layer.
304 virtual void VisitPooling2dLayer(const IConnectableLayer* layer,
305 const Pooling2dDescriptor& pooling2dDescriptor,
306 const char* name = nullptr) = 0;
307
Matteo Martincigh0e406ee2019-06-12 15:42:18 +0100308 /// Function that a PReLU activation 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 name - Optional name for the layer.
311 virtual void VisitPreluLayer(const IConnectableLayer* layer,
312 const char* name = nullptr) = 0;
313
Derek Lambertia9cca6a2019-03-25 15:41:58 +0000314 /// Function a quantize 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 VisitQuantizeLayer(const IConnectableLayer* layer,
318 const char* name = nullptr) = 0;
319
James Conroyee18dc82019-07-17 11:27:46 +0100320 /// Function a QuantizedLstm 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 params - The weights and biases for the Quantized LSTM cell
323 /// @param name - Optional name for the layer.
324 virtual void VisitQuantizedLstmLayer(const IConnectableLayer* layer,
325 const QuantizedLstmInputParams& params,
326 const char* name = nullptr) = 0;
327
Derek Lamberti61f54632019-03-25 16:28:44 +0000328 /// Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.
329 /// @param layer - pointer to the layer which is calling back to this visit function.
330 /// @param reshapeDescriptor - Parameters for the reshape operation.
331 /// @param name - Optional name for the layer.
332 virtual void VisitReshapeLayer(const IConnectableLayer* layer,
333 const ReshapeDescriptor& reshapeDescriptor,
334 const char* name = nullptr) = 0;
335
336 /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.
337 /// @param layer - pointer to the layer which is calling back to this visit function.
338 /// @param resizeDesc - Parameters for the resize operation.
339 /// @param name - Optional name for the layer.
Aron Virginas-Tar169d2f12019-07-01 19:01:44 +0100340 ARMNN_DEPRECATED_MSG("Use VisitResizeLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000341 virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer,
342 const ResizeBilinearDescriptor& resizeDesc,
343 const char* name = nullptr) = 0;
344
Teresa Charlina9075df2019-06-27 15:41:57 +0100345 /// Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
346 /// @param layer - pointer to the layer which is calling back to this visit function.
347 /// @param resizeDescriptor - Parameters for the resize operation.
348 /// @param name - Optional name for the layer.
349 virtual void VisitResizeLayer(const IConnectableLayer* layer,
350 const ResizeDescriptor& resizeDescriptor,
351 const char* name = nullptr) = 0;
352
Derek Lamberti61f54632019-03-25 16:28:44 +0000353 /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&)
354 /// function is invoked.
355 /// @param layer - pointer to the layer which is calling back to this visit function.
356 /// @param name - Optional name for the layer.
357 virtual void VisitRsqrtLayer(const IConnectableLayer* layer,
358 const char* name = nullptr) = 0;
359
Aron Virginas-Tar636ab402019-09-16 14:27:45 +0100360 /// Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
361 /// @param layer - pointer to the layer which is calling back to this visit function.
362 /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
363 /// @param name - Optional name for the layer.
364 virtual void VisitSliceLayer(const IConnectableLayer* layer,
365 const SliceDescriptor& sliceDescriptor,
366 const char* name = nullptr) = 0;
367
Derek Lamberti61f54632019-03-25 16:28:44 +0000368
369 /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
370 /// @param layer - pointer to the layer which is calling back to this visit function.
371 /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
372 /// @param name - Optional name for the layer.
373 virtual void VisitSoftmaxLayer(const IConnectableLayer* layer,
374 const SoftmaxDescriptor& softmaxDescriptor,
375 const char* name = nullptr) = 0;
376
377 /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
378 /// @param layer - pointer to the layer which is calling back to this visit function.
379 /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
380 /// @param name - Optional name for the layer.
381 virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer,
382 const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
383 const char* name = nullptr) = 0;
384
Aron Virginas-Tar972af152019-06-11 14:14:03 +0100385 /// Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.
386 /// @param layer - pointer to the layer which is calling back to this visit function.
387 /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
388 /// @param name - Optional name for the layer.
389 virtual void VisitSpaceToDepthLayer(const IConnectableLayer* layer,
390 const SpaceToDepthDescriptor& spaceToDepthDescriptor,
391 const char* name = nullptr) = 0;
392
Derek Lamberti61f54632019-03-25 16:28:44 +0000393 /// Function that a splitter 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.
Jim Flynne242f2d2019-05-22 14:24:13 +0100395 /// @param splitterDescriptor - ViewsDescriptor to configure the splitting process.
Derek Lamberti61f54632019-03-25 16:28:44 +0000396 /// Number of Views must be equal to the number of outputs,
397 /// and their order must match - e.g. first view corresponds to
398 /// the first output, second view to the second output, etc....
399 /// @param name - Optional name for the layer.
400 virtual void VisitSplitterLayer(const IConnectableLayer* layer,
401 const ViewsDescriptor& splitterDescriptor,
402 const char* name = nullptr) = 0;
403
Matthew Jackson2b8c1da2019-07-04 14:59:16 +0100404 /// Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.
405 /// @param layer - pointer to the layer which is calling back to this visit function.
406 /// @param stackDescriptor - Parameters for the stack operation.
407 /// @param name - Optional name for the layer.
408 virtual void VisitStackLayer(const IConnectableLayer* layer,
409 const StackDescriptor& stackDescriptor,
410 const char* name = nullptr) = 0;
411
jimfly015f4e41f2019-01-23 16:10:17 +0000412 /// Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
413 /// @param layer - pointer to the layer which is calling back to this visit function.
Aron Virginas-Tar639fb042019-06-20 14:28:19 +0100414 /// @param stridedSliceDescriptor - Parameters for the strided slice operation.
jimfly015f4e41f2019-01-23 16:10:17 +0000415 /// @param name - Optional name for the layer.
416 virtual void VisitStridedSliceLayer(const IConnectableLayer* layer,
417 const StridedSliceDescriptor& stridedSliceDescriptor,
418 const char* name = nullptr) = 0;
419
Derek Lamberti61f54632019-03-25 16:28:44 +0000420 /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000421 /// @param layer - pointer to the layer which is calling back to this visit function.
422 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000423 virtual void VisitSubtractionLayer(const IConnectableLayer* layer,
424 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000425
Sadik Armaganeff363d2019-04-05 15:25:46 +0100426 /// Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
427 /// @param layer - pointer to the layer which is calling back to this visit function.
428 /// @param name - Optional name for the layer.
429 virtual void VisitSwitchLayer(const IConnectableLayer* layer,
430 const char* name = nullptr) = 0;
431
Aron Virginas-Tar639fb042019-06-20 14:28:19 +0100432 /// Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&)
433 /// function is invoked.
434 /// @param layer - pointer to the layer which is calling back to this visit function.
435 /// @param descriptor - Description of the 2D transpose convolution layer.
436 /// @param weights - Tensor for the weights data.
437 /// @param biases - Optional tensor for the bias data.
438 /// @param name - Optional name for the layer.
439 virtual void VisitTransposeConvolution2dLayer(const IConnectableLayer* layer,
440 const TransposeConvolution2dDescriptor& descriptor,
441 const ConstTensor& weights,
442 const Optional<ConstTensor>& biases,
443 const char* name = nullptr) = 0;
444
Jim Flynnf92dfce2019-05-02 11:33:25 +0100445 virtual void StartVisit() {}
446 virtual void FinishVisit() {}
jimfly015f4e41f2019-01-23 16:10:17 +0000447
448};
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100449} // namespace armnn