blob: b5112a8f0b06320a9d5253b11a75db049217cf8e [file] [log] [blame]
jimfly015f4e41f2019-01-23 16:10:17 +00001//
Teresa Charlin52664732020-06-29 16:27:03 +01002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
jimfly015f4e41f2019-01-23 16:10:17 +00003// 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.
josh minor4a3c6102020-01-06 16:40:46 -060027 ARMNN_DEPRECATED_MSG("Use VisitElementwiseUnaryLayer instead")
Kevin May868eb142019-09-04 17:29:31 +010028 virtual void VisitAbsLayer(const IConnectableLayer* layer,
29 const char* name = nullptr) = 0;
30
Derek Lamberti61f54632019-03-25 16:28:44 +000031 /// Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +000032 /// @param layer - pointer to the layer which is calling back to this visit function.
Derek Lamberti61f54632019-03-25 16:28:44 +000033 /// @param activationDescriptor - ActivationDescriptor to configure the activation.
jimfly015f4e41f2019-01-23 16:10:17 +000034 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +000035 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
Nikhil Rajee391d52019-09-05 17:50:44 +010045 /// 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
Derek Lamberti61f54632019-03-25 16:28:44 +000053 /// 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
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +010078 /// 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
Jim Flynn906f9462019-05-10 13:55:21 +010086 /// 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.
Jim Flynne242f2d2019-05-22 14:24:13 +010088 /// @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....
Jim Flynn906f9462019-05-10 13:55:21 +010092 /// @param name - Optional name for the layer.
93 virtual void VisitConcatLayer(const IConnectableLayer* layer,
Jim Flynne242f2d2019-05-22 14:24:13 +010094 const OriginsDescriptor& concatDescriptor,
Jim Flynn906f9462019-05-10 13:55:21 +010095 const char* name = nullptr)
96 {
97 // default implementation to ease transition while MergerLayer is being deprecated
Jim Flynne242f2d2019-05-22 14:24:13 +010098 ARMNN_NO_DEPRECATE_WARN_BEGIN
99 VisitMergerLayer(layer, concatDescriptor, name);
100 ARMNN_NO_DEPRECATE_WARN_END
Jim Flynn906f9462019-05-10 13:55:21 +0100101 }
102
Derek Lamberti61f54632019-03-25 16:28:44 +0000103 /// 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;
jimfly015f4e41f2019-01-23 16:10:17 +0000113
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000114 /// Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&)
jimfly015f4e41f2019-01-23 16:10:17 +0000115 /// 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.
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000119 /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
jimfly015f4e41f2019-01-23 16:10:17 +0000120 /// @param name - Optional name for the layer.
121 virtual void VisitConvolution2dLayer(const IConnectableLayer* layer,
122 const Convolution2dDescriptor& convolution2dDescriptor,
123 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000124 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000125 const char* name = nullptr) = 0;
126
Aron Virginas-Tardd6247f2019-09-19 14:31:17 +0100127 /// 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
jimfly015f4e41f2019-01-23 16:10:17 +0000135 /// 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].
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000140 /// @param biases - Optional tensor for the bias data. If specified, must match the output tensor shape.
jimfly015f4e41f2019-01-23 16:10:17 +0000141 /// @param name - Optional name for the layer.
142 virtual void VisitDepthwiseConvolution2dLayer(const IConnectableLayer* layer,
143 const DepthwiseConvolution2dDescriptor& convolution2dDescriptor,
144 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000145 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000146 const char* name = nullptr) = 0;
147
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000148 /// 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
jimfly01d161ba02019-01-28 12:51:53 +0000155 /// 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.
Narumol Prangnawarat6d302bf2019-02-04 11:46:26 +0000159 /// @param anchors - Tensor for the anchors.
jimfly01d161ba02019-01-28 12:51:53 +0000160 /// @param name - Optional name for the layer.
161 virtual void VisitDetectionPostProcessLayer(const IConnectableLayer* layer,
162 const DetectionPostProcessDescriptor& descriptor,
Narumol Prangnawarat6d302bf2019-02-04 11:46:26 +0000163 const ConstTensor& anchors,
jimfly01d161ba02019-01-28 12:51:53 +0000164 const char* name = nullptr) = 0;
165
Derek Lamberti61f54632019-03-25 16:28:44 +0000166 /// 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
josh minor4a3c6102020-01-06 16:40:46 -0600172 /// 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
Derek Lamberti61f54632019-03-25 16:28:44 +0000180 /// 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.
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +0100183 ARMNN_DEPRECATED_MSG("Use VisitComparisonLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000184 virtual void VisitEqualLayer(const IConnectableLayer* layer,
185 const char* name = nullptr) = 0;
186
Ryan OSheaec6c6802020-06-05 17:17:06 +0100187 /// 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
Derek Lamberti61f54632019-03-25 16:28:44 +0000195 /// 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
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000201 /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&)
jimfly015f4e41f2019-01-23 16:10:17 +0000202 /// function is invoked.
203 /// @param layer - pointer to the layer which is calling back to this visit function.
204 /// @param fullyConnectedDescriptor - Description of the fully connected layer.
205 /// @param weights - Tensor for the weights data.
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000206 /// @param biases - Optional tensor for the bias data.
jimfly015f4e41f2019-01-23 16:10:17 +0000207 /// @param name - Optional name for the layer.
208 virtual void VisitFullyConnectedLayer(const IConnectableLayer* layer,
209 const FullyConnectedDescriptor& fullyConnectedDescriptor,
210 const ConstTensor& weights,
Aron Virginas-Tar00859782019-02-11 12:21:27 +0000211 const Optional<ConstTensor>& biases,
jimfly015f4e41f2019-01-23 16:10:17 +0000212 const char* name = nullptr) = 0;
213
Derek Lamberti61f54632019-03-25 16:28:44 +0000214 /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000215 /// @param layer - pointer to the layer which is calling back to this visit function.
jimfly015f4e41f2019-01-23 16:10:17 +0000216 /// @param name - Optional name for the layer.
Teresa Charlin52664732020-06-29 16:27:03 +0100217 ARMNN_DEPRECATED_MSG("Use VisitGatherLayer with descriptor instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000218 virtual void VisitGatherLayer(const IConnectableLayer* layer,
jimfly015f4e41f2019-01-23 16:10:17 +0000219 const char* name = nullptr) = 0;
220
Teresa Charlin52664732020-06-29 16:27:03 +0100221 /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.
222 /// @param layer - pointer to the layer which is calling back to this visit function.
223 /// @param gatherDescriptor - Parameters for the gather operation.
224 /// @param name - Optional name for the layer.
225 virtual void VisitGatherLayer(const IConnectableLayer* layer,
226 const GatherDescriptor& gatherDescriptor,
227 const char* name = nullptr) = 0;
228
Derek Lamberti61f54632019-03-25 16:28:44 +0000229 /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000230 /// @param layer - pointer to the layer which is calling back to this visit function.
231 /// @param name - Optional name for the layer.
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +0100232 ARMNN_DEPRECATED_MSG("Use VisitComparisonLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000233 virtual void VisitGreaterLayer(const IConnectableLayer* layer,
234 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000235
Derek Lamberti61f54632019-03-25 16:28:44 +0000236 /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000237 /// @param layer - pointer to the layer which is calling back to this visit function.
Derek Lamberti61f54632019-03-25 16:28:44 +0000238 /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified
239 /// when passing the inputs to the IRuntime::EnqueueWorkload() function.
jimfly015f4e41f2019-01-23 16:10:17 +0000240 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000241 virtual void VisitInputLayer(const IConnectableLayer* layer,
242 LayerBindingId id,
243 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000244
Kevin Mayce5045a2019-10-02 14:07:47 +0100245 /// Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&)
246 /// function is invoked.
247 /// @param layer - pointer to the layer which is calling back to this visit function.
248 /// @param desc - Parameters for the instance normalization operation.
249 /// @param name - Optional name for the layer.
250 virtual void VisitInstanceNormalizationLayer(const IConnectableLayer* layer,
251 const InstanceNormalizationDescriptor& desc,
252 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000253
254 /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&)
255 /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input.
256 /// @param layer - pointer to the layer which is calling back to this visit function.
257 /// @param desc - Parameters for the L2 normalization operation.
258 /// @param name - Optional name for the layer.
259 virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer,
260 const L2NormalizationDescriptor& desc,
261 const char* name = nullptr) = 0;
262
Aron Virginas-Tarf982dea2019-10-11 14:07:53 +0100263 /// Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
264 /// @param layer - pointer to the layer which is calling back to this visit function.
265 /// @param logSoftmaxDescriptor - LogSoftmaxDescriptor to configure the log softmax.
266 /// @param name - Optional name for the layer.
267 virtual void VisitLogSoftmaxLayer(const IConnectableLayer* layer,
268 const LogSoftmaxDescriptor& logSoftmaxDescriptor,
269 const char* name = nullptr) = 0;
270
James Conroyaba90cd2020-11-06 16:28:18 +0000271 /// Function that a logical binary layer should call back to when its Accept(ILayerVisitor&) function is invoked.
272 /// @param layer - pointer to the layer which is calling back to this visit function.
273 /// @param logicalBinaryDescriptor - LogicalBinaryDescriptor to configure the logical unary layer.
274 /// @param name - Optional name for the layer.
275 virtual void VisitLogicalBinaryLayer(const IConnectableLayer* layer,
276 const LogicalBinaryDescriptor& logicalBinaryDescriptor,
277 const char* name = nullptr) = 0;
278
jimfly015f4e41f2019-01-23 16:10:17 +0000279 /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
280 /// @param layer - pointer to the layer which is calling back to this visit function.
281 /// @param descriptor - Parameters controlling the operation of the Lstm operation.
282 /// @param params - The weights and biases for the LSTM cell.
283 /// @param name - Optional name for the layer.
284 virtual void VisitLstmLayer(const IConnectableLayer* layer,
285 const LstmDescriptor& descriptor,
286 const LstmInputParams& params,
287 const char* name = nullptr) = 0;
288
jimfly015f4e41f2019-01-23 16:10:17 +0000289 /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
290 /// @param layer - pointer to the layer which is calling back to this visit function.
291 /// @param name - Optional name for the layer.
292 virtual void VisitMaximumLayer(const IConnectableLayer* layer,
293 const char* name = nullptr) = 0;
294
295 /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.
296 /// @param layer - pointer to the layer which is calling back to this visit function.
297 /// @param meanDescriptor - Parameters for the mean operation.
298 /// @param name - Optional name for the layer.
299 virtual void VisitMeanLayer(const IConnectableLayer* layer,
300 const MeanDescriptor& meanDescriptor,
301 const char* name = nullptr) = 0;
302
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100303 /// Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked.
304 /// @param layer - pointer to the layer which is calling back to this visit function.
305 /// @param name - Optional name for the layer.
306 virtual void VisitMergeLayer(const IConnectableLayer* layer,
307 const char* name = nullptr) = 0;
308
Derek Lamberti61f54632019-03-25 16:28:44 +0000309 /// Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked.
310 /// @param layer - pointer to the layer which is calling back to this visit function.
Jim Flynne242f2d2019-05-22 14:24:13 +0100311 /// @param mergerDescriptor - MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation
312 /// process. Number of Views must be equal to the number of inputs, and their order
313 /// must match - e.g. first view corresponds to the first input, second view to the
314 /// second input, etc....
Derek Lamberti61f54632019-03-25 16:28:44 +0000315 /// @param name - Optional name for the layer.
Jim Flynne242f2d2019-05-22 14:24:13 +0100316 ARMNN_DEPRECATED_MSG("Use VisitConcatLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000317 virtual void VisitMergerLayer(const IConnectableLayer* layer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100318 const MergerDescriptor& mergerDescriptor,
Derek Lamberti61f54632019-03-25 16:28:44 +0000319 const char* name = nullptr) = 0;
320
321 /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked.
322 /// @param layer - pointer to the layer which is calling back to this visit function.
323 /// @param name - Optional name for the layer.
324 virtual void VisitMinimumLayer(const IConnectableLayer* layer,
325 const char* name = nullptr) = 0;
326
327 /// Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.
328 /// @param layer - pointer to the layer which is calling back to this visit function.
329 /// @param name - Optional name for the layer.
330 virtual void VisitMultiplicationLayer(const IConnectableLayer* layer,
331 const char* name = nullptr) = 0;
332
333 /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.
334 /// @param layer - pointer to the layer which is calling back to this visit function.
335 /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization.
336 /// @param name - Optional name for the layer.
337 virtual void VisitNormalizationLayer(const IConnectableLayer* layer,
338 const NormalizationDescriptor& normalizationDescriptor,
339 const char* name = nullptr) = 0;
340
341 /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.
342 /// @param layer - pointer to the layer which is calling back to this visit function.
343 /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified
344 /// when passing the outputs to the IRuntime::EnqueueWorkload() function.
345 /// @param name - Optional name for the layer.
346 virtual void VisitOutputLayer(const IConnectableLayer* layer,
347 LayerBindingId id,
348 const char* name = nullptr) = 0;
349
jimfly015f4e41f2019-01-23 16:10:17 +0000350 /// Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked.
351 /// @param layer - pointer to the layer which is calling back to this visit function.
352 /// @param paddings - n by 2 tensor, where n is the rank of the input tensor,
353 /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and
354 /// paddings[i,1] indicates the amount of padding to add after the end of dimension i
355 /// @param name - Optional name for the layer.
356 virtual void VisitPadLayer(const IConnectableLayer* layer,
357 const PadDescriptor& padDescriptor,
358 const char* name = nullptr) = 0;
359
Derek Lamberti61f54632019-03-25 16:28:44 +0000360 /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.
361 /// @param layer - pointer to the layer which is calling back to this visit function.
362 /// @param permuteDescriptor - PermuteDescriptor to configure the permute.
363 /// @param name - Optional name for the layer.
364 virtual void VisitPermuteLayer(const IConnectableLayer* layer,
365 const PermuteDescriptor& permuteDescriptor,
366 const char* name = nullptr) = 0;
367
368 /// Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked.
369 /// @param layer - pointer to the layer which is calling back to this visit function.
370 /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling.
371 /// @param name - Optional name for the layer.
372 virtual void VisitPooling2dLayer(const IConnectableLayer* layer,
373 const Pooling2dDescriptor& pooling2dDescriptor,
374 const char* name = nullptr) = 0;
375
Matteo Martincigh0e406ee2019-06-12 15:42:18 +0100376 /// Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.
377 /// @param layer - pointer to the layer which is calling back to this visit function.
378 /// @param name - Optional name for the layer.
379 virtual void VisitPreluLayer(const IConnectableLayer* layer,
380 const char* name = nullptr) = 0;
381
Derek Lambertia9cca6a2019-03-25 15:41:58 +0000382 /// Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
383 /// @param layer - pointer to the layer which is calling back to this visit function.
384 /// @param name - Optional name for the layer.
385 virtual void VisitQuantizeLayer(const IConnectableLayer* layer,
386 const char* name = nullptr) = 0;
387
James Conroy586a9aa2020-03-20 08:49:33 +0000388 /// Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
389 /// @param layer - pointer to the layer which is calling back to this visit function.
390 /// @param descriptor - Parameters controlling the operation of the QLstm operation.
391 /// @param params - The weights and biases for the layer
392 /// @param name - Optional name for the layer.
393 virtual void VisitQLstmLayer(const IConnectableLayer* layer,
394 const QLstmDescriptor& descriptor,
395 const LstmInputParams& params,
396 const char* name = nullptr) = 0;
397
James Conroyee18dc82019-07-17 11:27:46 +0100398 /// Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.
399 /// @param layer - pointer to the layer which is calling back to this visit function.
400 /// @param params - The weights and biases for the Quantized LSTM cell
401 /// @param name - Optional name for the layer.
402 virtual void VisitQuantizedLstmLayer(const IConnectableLayer* layer,
403 const QuantizedLstmInputParams& params,
404 const char* name = nullptr) = 0;
405
Finn Williams2605b232020-06-10 15:53:46 +0100406 /// Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked.
407 /// @param layer - pointer to the layer which is calling back to this visit function.
408 /// @param name - Optional name for the layer.
409 virtual void VisitRankLayer(const IConnectableLayer* layer,
410 const char* name = nullptr) = 0;
411
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000412 /// Function that a reduce layer should call back to when its Accept(ILayerVisitor&) function is invoked.
413 /// @param layer - pointer to the layer which is calling back to this visit function.
414 /// @param ReduceDescriptor - Parameters for the reduce max operation.
415 /// @param name - Optional name for the layer.
416 virtual void VisitReduceLayer(const IConnectableLayer* layer,
417 const ReduceDescriptor& reduceDescriptor,
418 const char* name = nullptr) = 0;
419
Derek Lamberti61f54632019-03-25 16:28:44 +0000420 /// Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.
421 /// @param layer - pointer to the layer which is calling back to this visit function.
422 /// @param reshapeDescriptor - Parameters for the reshape operation.
423 /// @param name - Optional name for the layer.
424 virtual void VisitReshapeLayer(const IConnectableLayer* layer,
425 const ReshapeDescriptor& reshapeDescriptor,
426 const char* name = nullptr) = 0;
427
428 /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.
429 /// @param layer - pointer to the layer which is calling back to this visit function.
430 /// @param resizeDesc - Parameters for the resize operation.
431 /// @param name - Optional name for the layer.
Aron Virginas-Tar169d2f12019-07-01 19:01:44 +0100432 ARMNN_DEPRECATED_MSG("Use VisitResizeLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000433 virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer,
434 const ResizeBilinearDescriptor& resizeDesc,
435 const char* name = nullptr) = 0;
436
Teresa Charlina9075df2019-06-27 15:41:57 +0100437 /// Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.
438 /// @param layer - pointer to the layer which is calling back to this visit function.
439 /// @param resizeDescriptor - Parameters for the resize operation.
440 /// @param name - Optional name for the layer.
441 virtual void VisitResizeLayer(const IConnectableLayer* layer,
442 const ResizeDescriptor& resizeDescriptor,
443 const char* name = nullptr) = 0;
444
Derek Lamberti61f54632019-03-25 16:28:44 +0000445 /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&)
446 /// function is invoked.
447 /// @param layer - pointer to the layer which is calling back to this visit function.
448 /// @param name - Optional name for the layer.
josh minor4a3c6102020-01-06 16:40:46 -0600449 ARMNN_DEPRECATED_MSG("Use VisitElementwiseUnaryLayer instead")
Derek Lamberti61f54632019-03-25 16:28:44 +0000450 virtual void VisitRsqrtLayer(const IConnectableLayer* layer,
451 const char* name = nullptr) = 0;
452
Aron Virginas-Tar636ab402019-09-16 14:27:45 +0100453 /// Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
454 /// @param layer - pointer to the layer which is calling back to this visit function.
455 /// @param sliceDescriptor - SliceDescriptor to configure the slice operation.
456 /// @param name - Optional name for the layer.
457 virtual void VisitSliceLayer(const IConnectableLayer* layer,
458 const SliceDescriptor& sliceDescriptor,
459 const char* name = nullptr) = 0;
460
Derek Lamberti61f54632019-03-25 16:28:44 +0000461
462 /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.
463 /// @param layer - pointer to the layer which is calling back to this visit function.
464 /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax.
465 /// @param name - Optional name for the layer.
466 virtual void VisitSoftmaxLayer(const IConnectableLayer* layer,
467 const SoftmaxDescriptor& softmaxDescriptor,
468 const char* name = nullptr) = 0;
469
470 /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
471 /// @param layer - pointer to the layer which is calling back to this visit function.
472 /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation.
473 /// @param name - Optional name for the layer.
474 virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer,
475 const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor,
476 const char* name = nullptr) = 0;
477
Aron Virginas-Tar972af152019-06-11 14:14:03 +0100478 /// Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.
479 /// @param layer - pointer to the layer which is calling back to this visit function.
480 /// @param spaceToDepthDescriptor - Parameters for the space to depth operation.
481 /// @param name - Optional name for the layer.
482 virtual void VisitSpaceToDepthLayer(const IConnectableLayer* layer,
483 const SpaceToDepthDescriptor& spaceToDepthDescriptor,
484 const char* name = nullptr) = 0;
485
Derek Lamberti61f54632019-03-25 16:28:44 +0000486 /// Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked.
487 /// @param layer - pointer to the layer which is calling back to this visit function.
Jim Flynne242f2d2019-05-22 14:24:13 +0100488 /// @param splitterDescriptor - ViewsDescriptor to configure the splitting process.
Derek Lamberti61f54632019-03-25 16:28:44 +0000489 /// Number of Views must be equal to the number of outputs,
490 /// and their order must match - e.g. first view corresponds to
491 /// the first output, second view to the second output, etc....
492 /// @param name - Optional name for the layer.
493 virtual void VisitSplitterLayer(const IConnectableLayer* layer,
494 const ViewsDescriptor& splitterDescriptor,
495 const char* name = nullptr) = 0;
496
Matthew Jackson2b8c1da2019-07-04 14:59:16 +0100497 /// Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.
498 /// @param layer - pointer to the layer which is calling back to this visit function.
499 /// @param stackDescriptor - Parameters for the stack operation.
500 /// @param name - Optional name for the layer.
501 virtual void VisitStackLayer(const IConnectableLayer* layer,
502 const StackDescriptor& stackDescriptor,
503 const char* name = nullptr) = 0;
504
Derek Lamberti013c3902019-10-21 10:46:16 +0100505 /// Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked
506 /// @param layer - pointer to the layer which is calling back to this visit function.
507 /// @param standInDescriptor - Parameters for the stand-in layer.
508 /// @param name - Optional name for the layer.
509 virtual void VisitStandInLayer(const IConnectableLayer* layer,
510 const StandInDescriptor& standInDescriptor,
511 const char* name = nullptr) = 0;
512
jimfly015f4e41f2019-01-23 16:10:17 +0000513 /// Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.
514 /// @param layer - pointer to the layer which is calling back to this visit function.
Aron Virginas-Tar639fb042019-06-20 14:28:19 +0100515 /// @param stridedSliceDescriptor - Parameters for the strided slice operation.
jimfly015f4e41f2019-01-23 16:10:17 +0000516 /// @param name - Optional name for the layer.
517 virtual void VisitStridedSliceLayer(const IConnectableLayer* layer,
518 const StridedSliceDescriptor& stridedSliceDescriptor,
519 const char* name = nullptr) = 0;
520
Derek Lamberti61f54632019-03-25 16:28:44 +0000521 /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.
jimfly015f4e41f2019-01-23 16:10:17 +0000522 /// @param layer - pointer to the layer which is calling back to this visit function.
523 /// @param name - Optional name for the layer.
Derek Lamberti61f54632019-03-25 16:28:44 +0000524 virtual void VisitSubtractionLayer(const IConnectableLayer* layer,
525 const char* name = nullptr) = 0;
jimfly015f4e41f2019-01-23 16:10:17 +0000526
Sadik Armaganeff363d2019-04-05 15:25:46 +0100527 /// Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked.
528 /// @param layer - pointer to the layer which is calling back to this visit function.
529 /// @param name - Optional name for the layer.
530 virtual void VisitSwitchLayer(const IConnectableLayer* layer,
531 const char* name = nullptr) = 0;
532
Aron Virginas-Tar639fb042019-06-20 14:28:19 +0100533 /// Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&)
534 /// function is invoked.
535 /// @param layer - pointer to the layer which is calling back to this visit function.
536 /// @param descriptor - Description of the 2D transpose convolution layer.
537 /// @param weights - Tensor for the weights data.
538 /// @param biases - Optional tensor for the bias data.
539 /// @param name - Optional name for the layer.
540 virtual void VisitTransposeConvolution2dLayer(const IConnectableLayer* layer,
541 const TransposeConvolution2dDescriptor& descriptor,
542 const ConstTensor& weights,
543 const Optional<ConstTensor>& biases,
544 const char* name = nullptr) = 0;
545
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000546 /// Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked.
547 /// @param layer - pointer to the layer which is calling back to this visit function.
548 /// @param transposeDescriptor - TransposeDescriptor to configure the transpose.
549 /// @param name - Optional name for the layer.
550 virtual void VisitTransposeLayer(const IConnectableLayer* layer,
551 const TransposeDescriptor& transposeDescriptor,
552 const char* name = nullptr) = 0;
553
Jim Flynnf92dfce2019-05-02 11:33:25 +0100554 virtual void StartVisit() {}
555 virtual void FinishVisit() {}
jimfly015f4e41f2019-01-23 16:10:17 +0000556
557};
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100558} // namespace armnn