blob: 22fc0416847860a349998fe242d965704103b2bd [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010024#ifndef __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__
25#define __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__
Georgios Pinitasd8734b52017-12-22 15:27:52 +000026
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010027#include "arm_compute/graph/ITensorAccessor.h"
28#include "arm_compute/graph/Types.h"
Georgios Pinitasd8734b52017-12-22 15:27:52 +000029
30namespace arm_compute
31{
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010032namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +000033{
34// Forward declaration
35class Graph;
36
37/** Graph builder class
38 *
39 * Builds and compiles a graph
40 */
41class GraphBuilder final
42{
43public:
44 /** Adds a Const node to the graph
45 *
46 * @param[in] g Graph to add the node to
47 * @param[in] params Common node parameters
48 * @param[in] desc Tensor descriptor of the node
49 * @param[in] accessor (Optional) Accessor of the const node data
50 *
51 * @return Node ID of the created node, EmptyNodeID in case of error
52 */
53 static NodeID add_const_node(Graph &g, NodeParams params, TensorDescriptor desc, ITensorAccessorUPtr accessor = nullptr);
54 /** Adds an input layer node to the graph
55 *
56 * @param[in] g Graph to add the node to
57 * @param[in] params Common node parameters
58 * @param[in] desc Tensor descriptor of the Tensor
59 * @param[in] accessor (Optional) Accessor of the input node data
60 *
61 * @return Node ID of the created node, EmptyNodeID in case of error
62 */
63 static NodeID add_input_node(Graph &g, NodeParams params, TensorDescriptor desc, ITensorAccessorUPtr accessor = nullptr);
64 /** Adds an output layer node to the graph
65 *
66 * @param[in] g Graph to add the node to
67 * @param[in] params Common node parameters
68 * @param[in] input Input to the output node as a NodeID-Index pair
69 * @param[in] accessor (Optional) Accessor of the output node data
70 *
71 * @return Node ID of the created node, EmptyNodeID in case of error
72 */
73 static NodeID add_output_node(Graph &g, NodeParams params, NodeIdxPair input, ITensorAccessorUPtr accessor = nullptr);
74 /** Adds an activation layer node to the graph
75 *
76 * @param[in] g Graph to add the node to
77 * @param[in] params Common node parameters
78 * @param[in] input Input to the activation layer node as a NodeID-Index pair
79 * @param[in] act_info Activation layer information
80 *
81 * @return Node ID of the created node, EmptyNodeID in case of error
82 */
83 static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info);
84 /** Adds a batch normalization layer node to the graph
85 *
86 * @param[in] g Graph to add the node to
87 * @param[in] params Common node parameters
88 * @param[in] input Input to the batch normalization layer node as a NodeID-Index pair
89 * @param[in] epsilon Epsilon parameter
90 * @param[in] mean_accessor Const Node ID that contains the mean values
91 * @param[in] var_accessor Const Node ID that contains the variance values
92 * @param[in] beta_accessor Const Node ID that contains the beta values. Can be EmptyNodeID
93 * @param[in] gamma_accessor Const Node ID that contains the gamma values. Can be EmptyNodeID
94 *
95 * @return Node ID of the created node, EmptyNodeID in case of error
96 */
97 static NodeID add_batch_normalization_node(Graph &g, NodeParams params, NodeIdxPair input, float epsilon,
98 ITensorAccessorUPtr mean_accessor = nullptr, ITensorAccessorUPtr var_accessor = nullptr,
99 ITensorAccessorUPtr beta_accessor = nullptr, ITensorAccessorUPtr gamma_accessor = nullptr);
Manuel Bottinid2048ce2018-10-23 17:00:42 +0100100 /** Adds a bounding box transform layer node to the graph
101 *
102 * @param[in] g Graph to add the node to
103 * @param[in] params Common node parameters
104 * @param[in] input Input to the bounding box transform layer node as a NodeID-Index pair
105 * @param[in] deltas Deltas input to the bounding box transform layer node as a NodeID-Index pair
106 * @param[in] info Bounding Box Transform information
107 *
108 * @return Node ID of the created node, EmptyNodeID in case of error
109 */
110 static NodeID add_bounding_box_transform_node(Graph &g, NodeParams params, NodeIdxPair input, NodeIdxPair deltas, BoundingBoxTransformInfo info);
Georgios Pinitas087eaf62018-05-16 15:52:35 +0100111 /** Adds an channel shuffle layer node to the graph
112 *
113 * @param[in] g Graph to add the node to
114 * @param[in] params Common node parameters
115 * @param[in] input Input to the activation layer node as a NodeID-Index pair
116 * @param[in] num_groups Number of groups
117 *
118 * @return Node ID of the created node, EmptyNodeID in case of error
119 */
120 static NodeID add_channel_shuffle_node(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_groups);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000121 /** Adds a convolution layer node to the graph
122 *
Giorgio Arena59631a12018-05-02 13:59:04 +0100123 * TODO (COMPMID-1113): Add a graph descriptor for convolution layer node
124 *
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000125 * @param[in] g Graph to add the node to
126 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000127 * @param[in] input Input to the convolution layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000128 * @param[in] kernel_spatial_extend Spatial extend of convolution kernels
129 * @param[in] depth Number of convolution kernels
130 * @param[in] conv_info Convolution layer information
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000131 * @param[in] num_groups (Optional) Number of groups for a grouped convolution. Defaults to 1
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000132 * @param[in] method (Optional) Convolution method to use
Giorgio Arena59631a12018-05-02 13:59:04 +0100133 * @param[in] fast_math_hint (Optional) Fast math hint
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000134 * @param[in] weights_accessor (Optional) Accessor of the weights node data
135 * @param[in] bias_accessor (Optional) Accessor of the bias node data
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100136 * @param[in] weights_quant_info (Optional) Weights quantization info
137 * @param[in] out_quant_info (Optional) Output quantization info
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000138 *
139 * @return Node ID of the created node, EmptyNodeID in case of error
140 */
141 static NodeID add_convolution_node(Graph &g, NodeParams params, NodeIdxPair input,
Georgios Pinitase2220552018-07-20 13:23:44 +0100142 Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo conv_info, unsigned int num_groups = 1,
143 ConvolutionMethod method = ConvolutionMethod::Default, FastMathHint fast_math_hint = FastMathHint::Disabled,
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100144 ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr,
145 const QuantizationInfo weights_quant_info = QuantizationInfo(),
146 const QuantizationInfo out_quant_info = QuantizationInfo());
Georgios Pinitas087eaf62018-05-16 15:52:35 +0100147 /** Adds a deconvolution layer node to the graph
148 *
149 * @param[in] g Graph to add the node to
150 * @param[in] params Common node parameters
151 * @param[in] input Input to the convolution layer node as a NodeID-Index pair
152 * @param[in] kernel_spatial_extend Spatial extend of convolution kernels
153 * @param[in] depth Number of convolution kernels
154 * @param[in] deconv_info Convolution layer information
155 * @param[in] inner_border Inner border (right, top)
156 * @param[in] weights_accessor (Optional) Accessor of the weights node data
157 * @param[in] bias_accessor (Optional) Accessor of the bias node data
158 *
159 * @return Node ID of the created node, EmptyNodeID in case of error
160 */
161 static NodeID add_deconvolution_node(Graph &g, NodeParams params, NodeIdxPair input,
162 Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo deconv_info, Size2D inner_border,
163 ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000164 /** Adds a depth concatenate node to the graph
165 *
166 * @param[in] g Graph to add the node to
167 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000168 * @param[in] inputs Inputs to the depth concatenate layer node as a NodeID-Index pair
Georgios Pinitase2220552018-07-20 13:23:44 +0100169 * @param[in] axis Concatenation axis
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000170 *
171 * @return Node ID of the created node, EmptyNodeID in case of error
172 */
Georgios Pinitase2220552018-07-20 13:23:44 +0100173 static NodeID add_concatenate_node(Graph &g, NodeParams params, std::vector<NodeIdxPair> inputs, DataLayoutDimension axis);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000174 /** Adds a depth-wise convolution layer node to the graph
175 *
176 * @param[in] g Graph to add the node to
177 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000178 * @param[in] input Input to the depthwise convolution layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000179 * @param[in] kernel_spatial_extend Spatial extend of convolution kernels
180 * @param[in] conv_info Convolution layer information
181 * @param[in] method (Optional) Convolution method to use
182 * @param[in] weights_accessor (Optional) Accessor of the weights node data
183 * @param[in] bias_accessor (Optional) Accessor of the bias node data
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100184 * @param[in] quant_info (Optional) Weights quantization info
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000185 *
186 * @return Node ID of the created node, EmptyNodeID in case of error
187 */
188 static NodeID add_depthwise_convolution_node(Graph &g, NodeParams params, NodeIdxPair input,
189 Size2D kernel_spatial_extend, PadStrideInfo conv_info,
Georgios Pinitase2220552018-07-20 13:23:44 +0100190 DepthwiseConvolutionMethod method = DepthwiseConvolutionMethod::Default,
Giorgio Arenabb54e4e2018-04-05 17:20:34 +0100191 ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const QuantizationInfo quant_info = QuantizationInfo());
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000192 /** Adds an element-wise layer node to the graph
193 *
194 * @param[in] g Graph to add the node to
195 * @param[in] params Common node parameters
196 * @param[in] input0 First input to the element-wise operation layer node as a NodeID-Index pair
197 * @param[in] input1 Second input to the element-wise operation layer node as a NodeID-Index pair
198 * @param[in] operation Element-wise operation to perform
199 *
200 * @return Node ID of the created node, EmptyNodeID in case of error
201 */
202 static NodeID add_elementwise_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, EltwiseOperation operation);
Georgios Pinitas087eaf62018-05-16 15:52:35 +0100203 /** Adds a Dummy node to the graph
204 *
205 * @note this node if for debugging purposes. Just alters the shape of the graph pipeline as requested.
206 *
207 * @param[in] g Graph to add the node to
208 * @param[in] params Common node parameters
209 * @param[in] input Input to the dummy node as a NodeID-Index pair
210 * @param[in] shape Output shape
211 *
212 * @return Node ID of the created node, EmptyNodeID in case of error
213 */
214 static NodeID add_dummy_node(Graph &g, NodeParams params, NodeIdxPair input, TensorShape shape);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000215 /** Adds a flatten layer node to the graph
216 *
217 * @param[in] g Graph to add the node to
218 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000219 * @param[in] input Input to the flatten layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000220 *
221 * @return Node ID of the created node, EmptyNodeID in case of error
222 */
223 static NodeID add_flatten_node(Graph &g, NodeParams params, NodeIdxPair input);
224 /** Adds a fully connected layer node to the graph
225 *
Georgios Pinitas2f1366a2018-07-31 16:33:06 +0100226 * @param[in] g Graph to add the layer to
227 * @param[in] params Common node parameters
228 * @param[in] input Input to the fully connected layer node as a NodeID-Index pair
229 * @param[in] num_outputs Number of output neurons
230 * @param[in] weights_accessor (Optional) Accessor of the weights node data
231 * @param[in] bias_accessor (Optional) Accessor of the bias node data
Georgios Pinitasc55cef12018-08-01 15:24:18 +0100232 * @param[in] fc_info (Optional) Fully connected layer metadata
Georgios Pinitas2f1366a2018-07-31 16:33:06 +0100233 * @param[in] weights_quant_info (Optional) Weights quantization info
234 * @param[in] out_quant_info (Optional) Output quantization info
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000235 *
236 * @return Node ID of the created node, EmptyNodeID in case of error
237 */
238 static NodeID add_fully_connected_layer(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_outputs,
Georgios Pinitas2f1366a2018-07-31 16:33:06 +0100239 ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr,
Georgios Pinitasc55cef12018-08-01 15:24:18 +0100240 const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(),
241 const QuantizationInfo weights_quant_info = QuantizationInfo(),
242 const QuantizationInfo out_quant_info = QuantizationInfo());
Michele Di Giorgio47e6fed2018-11-13 12:04:25 +0000243 /** Adds a generate proposals layer node to the graph
244 *
245 * @param[in] g Graph to add the layer to
246 * @param[in] params Common node parameters
247 * @param[in] scores Input scores to the generate proposals layer node as a NodeID-Index pair
248 * @param[in] deltas Input deltas to the generate proposals layer node as a NodeID-Index pair
249 * @param[in] anchors Input anchors to the generate proposals layer node as a NodeID-Index pair
250 * @param[in] info Generate proposals operation information
251 *
252 * @return Node ID of the created node, EmptyNodeID in case of error
253 */
254 static NodeID add_generate_proposals_node(Graph &g, NodeParams params, NodeIdxPair scores, NodeIdxPair deltas,
255 NodeIdxPair anchors, GenerateProposalsInfo info);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000256 /** Adds a normalization layer node to the graph
257 *
258 * @param[in] g Graph to add the node to
259 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000260 * @param[in] input Input to the normalization layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000261 * @param[in] norm_info Normalization layer information
262 *
263 * @return Node ID of the created node, EmptyNodeID in case of error
264 */
265 static NodeID add_normalization_node(Graph &g, NodeParams params, NodeIdxPair input, NormalizationLayerInfo norm_info);
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100266 /** Adds a normalize planar YUV layer node to the graph
267 *
268 * @param[in] g Graph to add the node to
269 * @param[in] params Common node parameters
270 * @param[in] input Input to the normalize planar YUV layer node as a NodeID-Index pair
271 * @param[in] mean_accessor Const Node ID that contains the mean values
272 * @param[in] std_accessor Const Node ID that contains the variance values
273 *
274 * @return Node ID of the created node, EmptyNodeID in case of error
275 */
276 static NodeID add_normalize_planar_yuv_node(Graph &g, NodeParams params, NodeIdxPair input,
277 ITensorAccessorUPtr mean_accessor = nullptr, ITensorAccessorUPtr std_accessor = nullptr);
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100278 /** Adds a pad layer node to the graph
279 *
280 * @param[in] g Graph to add the node to
281 * @param[in] params Common node parameters
282 * @param[in] input Input to the reshape layer node as a NodeID-Index pair
283 * @param[in] padding The padding for each spatial dimension of the input tensor. The pair padding[i]
284 * specifies the front and the end padding in the i-th dimension.
285 *
286 * @return Node ID of the created node, EmptyNodeID in case of error
287 */
288 static NodeID add_pad_node(Graph &g, NodeParams params, NodeIdxPair input, PaddingList padding);
Georgios Pinitas57c48242018-08-02 13:41:49 +0100289 /** Adds a permute layer node to the graph
290 *
291 * @param[in] g Graph to add the node to
292 * @param[in] params Common node parameters
293 * @param[in] input Input to the reshape layer node as a NodeID-Index pair
294 * @param[in] perm Permutation vector
295 * @param[in] layout (Optional) Data layout to assign to permuted tensor.
296 * If UNKNOWN then the input's layout will be used.
297 *
298 * @return Node ID of the created node, EmptyNodeID in case of error
299 */
300 static NodeID add_permute_node(Graph &g, NodeParams params, NodeIdxPair input, PermutationVector perm, DataLayout layout = DataLayout::UNKNOWN);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000301 /** Adds a pooling layer node to the graph
302 *
303 * @param[in] g Graph to add the node to
304 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000305 * @param[in] input Input to the pooling layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000306 * @param[in] pool_info Pooling layer information
307 *
308 * @return Node ID of the created node, EmptyNodeID in case of error
309 */
310 static NodeID add_pooling_node(Graph &g, NodeParams params, NodeIdxPair input, PoolingLayerInfo pool_info);
Gian Marco Iodice23e24792018-09-07 15:32:14 +0100311 /** Adds a reorg layer node to the graph
312 *
313 * @param[in] g Graph to add the node to
314 * @param[in] params Common node parameters
315 * @param[in] input Input to the reorg layer node as a NodeID-Index pair
316 * @param[in] stride Stride value to use for reorganizing the values in the output tensor.
317 *
318 * @return Node ID of the created node, EmptyNodeID in case of error
319 */
320 static NodeID add_reorg_node(Graph &g, NodeParams params, NodeIdxPair input, int stride);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000321 /** Adds a reshape layer node to the graph
322 *
323 * @param[in] g Graph to add the node to
324 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000325 * @param[in] input Input to the reshape layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000326 * @param[in] shape Output reshaped shape
327 *
328 * @return Node ID of the created node, EmptyNodeID in case of error
329 */
330 static NodeID add_reshape_node(Graph &g, NodeParams params, NodeIdxPair input, TensorShape shape);
Georgios Pinitas087eaf62018-05-16 15:52:35 +0100331 /** Adds a resize layer node to the graph
332 *
333 * @param[in] g Graph to add the node to
334 * @param[in] params Common node parameters
335 * @param[in] input Input to the reshape layer node as a NodeID-Index pair
336 * @param[in] policy Interpolation policy
337 * @param[in] width_scale Width scaling factor
338 * @param[in] height_scale Height scaling factor
339 *
340 * @return Node ID of the created node, EmptyNodeID in case of error
341 */
342 static NodeID add_resize_node(Graph &g, NodeParams params, NodeIdxPair input, InterpolationPolicy policy, float width_scale, float height_scale);
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100343 /** Adds a ROI align layer node to the graph
344 *
345 * @param[in] g Graph to add the node to
346 * @param[in] params Common node parameters
347 * @param[in] input Input to the reshape layer node as a NodeID-Index pair
348 * @param[in] rois Input containing @ref ROI.
349 * @param[in] pool_info Contains pooling operation information described in @ref ROIPoolingLayerInfo.
350 *
351 * @return Node ID of the created node, EmptyNodeID in case of error
352 */
353 static NodeID add_roi_align_node(Graph &g, NodeParams params, NodeIdxPair input, NodeIdxPair rois, ROIPoolingLayerInfo pool_info);
Isabella Gottardi88d5b222018-04-06 12:24:55 +0100354 /** Adds a scale layer node to the graph
355 * This layer computes a product of the input with a scale (read from mul_accessor) and it applies an offset (read from add_accessor).
356 * output = input * mul_w + add_w
357 *
358 * @param[in] g Graph to add the layer to
359 * @param[in] params Common node parameters
360 * @param[in] input Input to the fully connected layer node as a NodeID-Index pair
361 * @param[in] mul_accessor (Optional) Accessor of the mul node data
362 * @param[in] add_accessor (Optional) Accessor of the add node data
363 *
364 * @return Node ID of the created node, EmptyNodeID in case of error
365 */
366 static NodeID add_scale_layer(Graph &g, const NodeParams &params, NodeIdxPair input,
367 ITensorAccessorUPtr mul_accessor = nullptr, ITensorAccessorUPtr add_accessor = nullptr);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000368 /** Adds a softmax node to the graph
369 *
370 * @param[in] g Graph to add the node to
371 * @param[in] params Common node parameters
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000372 * @param[in] input Input to the softmax layer node as a NodeID-Index pair
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000373 * @param[in] beta Beta parameter
374 *
375 * @return Node ID of the created node, EmptyNodeID in case of error
376 */
377 static NodeID add_softmax_node(Graph &g, NodeParams params, NodeIdxPair input, float beta = 1.f);
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100378 /** Adds a slice node to the graph
379 *
380 * @param[in] g Graph to add the node to
381 * @param[in] params Common node parameters
382 * @param[in] input Input to the slice layer node as a NodeID-Index pair
383 * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
384 * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
385 *
386 * @return Node ID of the created node, EmptyNodeID in case of error
387 */
388 static NodeID add_slice_node(Graph &g, NodeParams params, NodeIdxPair input, Coordinates &starts, Coordinates &ends);
Georgios Pinitasee33ea52018-03-08 16:01:29 +0000389 /** Adds a split node to the graph
390 *
391 * @param[in] g Graph to add the node to
392 * @param[in] params Common node parameters
393 * @param[in] input Input to the split layer node as a NodeID-Index pair
394 * @param[in] num_splits Number of different splits
395 * @param[in] axis (Optional) Split axis. Defaults to 0
396 *
397 * @return Node ID of the created node, EmptyNodeID in case of error
398 */
399 static NodeID add_split_node(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_splits, unsigned int axis = 0);
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100400 /** Adds an upsample layer to the graph
401 *
402 * @param[in] g Graph to add the node to
403 * @param[in] params Common node parameters
404 * @param[in] input Input to the yolo layer node as a NodeID-Index pair
405 * @param[in] info Upsample layer stride info
406 * @param[in] upsampling_policy Upsampling policy used
407 *
408 * @return Node ID of the created node, EmptyNodeID in case of error
409 */
410 static NodeID add_upsample_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D info, InterpolationPolicy upsampling_policy);
Michalis Spyrou96f67692018-09-13 11:39:28 +0100411 /** Adds a yolo layer to the graph
412 *
413 * @param[in] g Graph to add the node to
414 * @param[in] params Common node parameters
415 * @param[in] input Input to the yolo layer node as a NodeID-Index pair
416 * @param[in] act_info Activation layer parameters
417 * @param[in] num_classes Number of classes to activate
418 *
419 * @return Node ID of the created node, EmptyNodeID in case of error
420 */
421 static NodeID add_yolo_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info, int32_t num_classes);
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000422};
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100423} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000424} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100425#endif /* __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__ */