Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 1 | /* |
| 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 Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 24 | #ifndef __ARM_COMPUTE_GRAPH_LAYERS_H__ |
| 25 | #define __ARM_COMPUTE_GRAPH_LAYERS_H__ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 26 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 27 | #include "arm_compute/graph/GraphBuilder.h" |
| 28 | #include "arm_compute/graph/Types.h" |
| 29 | #include "arm_compute/graph/frontend/ILayer.h" |
| 30 | #include "arm_compute/graph/frontend/IStream.h" |
| 31 | #include "arm_compute/graph/frontend/SubStream.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 32 | |
| 33 | #include "arm_compute/core/utils/misc/Utility.h" |
| 34 | |
| 35 | #include <memory> |
| 36 | #include <string> |
| 37 | |
| 38 | namespace arm_compute |
| 39 | { |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 40 | namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 41 | { |
| 42 | namespace frontend |
| 43 | { |
| 44 | /** Input Layer */ |
| 45 | class InputLayer final : public ILayer |
| 46 | { |
| 47 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 48 | /** Construct an input layer. |
| 49 | * |
| 50 | * @param[in] desc Description of input tensor. |
| 51 | * @param[in] accessor Accessor to get input tensor data from. |
| 52 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 53 | InputLayer(TensorDescriptor desc, ITensorAccessorUPtr accessor) |
| 54 | : _desc(desc), _accessor(std::move(accessor)) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | NodeID create_layer(IStream &s) override |
| 59 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 60 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 61 | return GraphBuilder::add_input_node(s.graph(), common_params, _desc, std::move(_accessor)); |
| 62 | } |
| 63 | |
| 64 | private: |
| 65 | TensorDescriptor _desc; |
| 66 | ITensorAccessorUPtr _accessor; |
| 67 | }; |
| 68 | |
| 69 | /** Output Layer */ |
| 70 | class OutputLayer final : public ILayer |
| 71 | { |
| 72 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 73 | /** Construct an output layer. |
| 74 | * |
| 75 | * @param[in] accessor Accessor to give output tensor data to. |
| 76 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 77 | OutputLayer(ITensorAccessorUPtr accessor) |
| 78 | : _accessor(std::move(accessor)) |
| 79 | { |
| 80 | } |
| 81 | |
| 82 | NodeID create_layer(IStream &s) override |
| 83 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 84 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 85 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 86 | return GraphBuilder::add_output_node(s.graph(), common_params, input, std::move(_accessor)); |
| 87 | } |
| 88 | |
| 89 | private: |
| 90 | ITensorAccessorUPtr _accessor; |
| 91 | }; |
| 92 | |
| 93 | /** Activation Layer */ |
| 94 | class ActivationLayer final : public ILayer |
| 95 | { |
| 96 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 97 | /** Construct an activation layer. |
| 98 | * |
| 99 | * @param[in] act_info Activation information |
| 100 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 101 | ActivationLayer(ActivationLayerInfo act_info) |
| 102 | : _act_info(act_info) |
| 103 | { |
| 104 | } |
| 105 | |
| 106 | NodeID create_layer(IStream &s) override |
| 107 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 108 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 109 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 110 | return GraphBuilder::add_activation_node(s.graph(), common_params, input, _act_info); |
| 111 | } |
| 112 | |
| 113 | private: |
| 114 | ActivationLayerInfo _act_info; |
| 115 | }; |
| 116 | |
| 117 | /** Batchnormalization Layer */ |
| 118 | class BatchNormalizationLayer final : public ILayer |
| 119 | { |
| 120 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 121 | /** Construct a batch normalization layer. |
| 122 | * |
| 123 | * @param[in] mean Accessor to get mean tensor data from. |
| 124 | * @param[in] var Accessor to get var tensor data from. |
| 125 | * @param[in] gamma (Optional) Accessor to get gamma tensor data from. Default: nullptr. |
| 126 | * @param[in] beta (Optional) Accessor to get beta tensor data from. Default: nullptr. |
| 127 | * @param[in] epsilon (Optional) Epsilon value. Default: 0.001. |
| 128 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 129 | BatchNormalizationLayer(ITensorAccessorUPtr mean, |
| 130 | ITensorAccessorUPtr var, |
| 131 | ITensorAccessorUPtr gamma = nullptr, |
| 132 | ITensorAccessorUPtr beta = nullptr, |
| 133 | float epsilon = 0.001f) |
| 134 | : _mean(std::move(mean)), _var(std::move(var)), _gamma(std::move(gamma)), _beta(std::move(beta)), _epsilon(epsilon) |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | NodeID create_layer(IStream &s) override |
| 139 | { |
| 140 | ARM_COMPUTE_ERROR_ON(_mean == nullptr); |
| 141 | ARM_COMPUTE_ERROR_ON(_var == nullptr); |
| 142 | |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 143 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 144 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 145 | return GraphBuilder::add_batch_normalization_node(s.graph(), common_params, input, _epsilon, |
| 146 | std::move(_mean), std::move(_var), std::move(_beta), std::move(_gamma)); |
| 147 | } |
| 148 | |
| 149 | private: |
| 150 | ITensorAccessorUPtr _mean; |
| 151 | ITensorAccessorUPtr _var; |
| 152 | ITensorAccessorUPtr _gamma; |
| 153 | ITensorAccessorUPtr _beta; |
| 154 | float _epsilon; |
| 155 | }; |
| 156 | |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 157 | /** Channel Shuffle Layer */ |
| 158 | class ChannelShuffleLayer final : public ILayer |
| 159 | { |
| 160 | public: |
| 161 | /** Construct a Channel Shuffle layer. |
| 162 | * |
| 163 | * @param[in] num_groups Number of groups |
| 164 | */ |
| 165 | ChannelShuffleLayer(unsigned int num_groups) |
| 166 | : _num_groups(num_groups) |
| 167 | { |
| 168 | } |
| 169 | |
| 170 | NodeID create_layer(IStream &s) override |
| 171 | { |
| 172 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 173 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 174 | return GraphBuilder::add_channel_shuffle_node(s.graph(), common_params, input, _num_groups); |
| 175 | } |
| 176 | |
| 177 | private: |
| 178 | unsigned int _num_groups; |
| 179 | }; |
| 180 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 181 | /** Concat Layer */ |
| 182 | class ConcatLayer final : public ILayer |
| 183 | { |
| 184 | public: |
| 185 | /** Construct a concatenation layer |
| 186 | * |
| 187 | * @param[in] sub_stream1 First graph branch |
| 188 | * @param[in] sub_stream2 Second graph branch |
| 189 | * @param[in] rest_sub_streams Rest sub-graph branches |
| 190 | */ |
| 191 | template <typename... Ts> |
| 192 | ConcatLayer(SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams) |
| 193 | : _sub_streams() |
| 194 | { |
| 195 | _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream1))); |
| 196 | _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream2))); |
| 197 | |
| 198 | utility::for_each([&](SubStream && sub_stream) |
| 199 | { |
| 200 | _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream))); |
| 201 | }, |
| 202 | std::move(rest_sub_streams)...); |
| 203 | } |
| 204 | /** Construct a concat layer |
| 205 | * |
| 206 | * @param[in] sub_stream Sub-stream |
| 207 | */ |
| 208 | template <typename... Ts> |
| 209 | ConcatLayer(SubStream &&sub_stream) |
| 210 | : _sub_streams() |
| 211 | { |
| 212 | _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream))); |
| 213 | } |
| 214 | NodeID create_layer(IStream &s) override |
| 215 | { |
| 216 | NodeID nid = EmptyNodeID; |
| 217 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 218 | if(_sub_streams.size() == 1 && _sub_streams.at(0) != nullptr) |
| 219 | { |
| 220 | nid = _sub_streams[0]->tail_node(); |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | // Collect tail nodes and concatenate |
| 225 | std::vector<NodeIdxPair> nodes; |
| 226 | for(auto &ss : _sub_streams) |
| 227 | { |
| 228 | if(ss && (ss->tail_node() != EmptyNodeID)) |
| 229 | { |
| 230 | const auto tail_node = s.graph().node(ss->tail_node()); |
| 231 | if(tail_node != nullptr && tail_node->type() != NodeType::Output) |
| 232 | { |
| 233 | nodes.push_back({ ss->tail_node(), 0 }); |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | nid = GraphBuilder::add_concatenate_node(s.graph(), common_params, nodes, DataLayoutDimension::CHANNEL); |
| 238 | } |
| 239 | return nid; |
| 240 | } |
| 241 | |
| 242 | private: |
| 243 | std::vector<std::unique_ptr<SubStream>> _sub_streams; |
| 244 | }; |
| 245 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 246 | /** Convolution Layer */ |
| 247 | class ConvolutionLayer final : public ILayer |
| 248 | { |
| 249 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 250 | /** Construct a convolution layer. |
| 251 | * |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 252 | * @param[in] conv_width Convolution width. |
| 253 | * @param[in] conv_height Convolution height. |
| 254 | * @param[in] ofm Output feature map. |
| 255 | * @param[in] weights Accessor to get kernel weights from. |
| 256 | * @param[in] bias Accessor to get kernel bias from. |
| 257 | * @param[in] conv_info Padding and stride information. |
| 258 | * @param[in] num_groups (Optional) Number of groups. Default: 1. |
| 259 | * @param[in] weights_quant_info (Optional) Weights quantization information |
| 260 | * @param[in] out_quant_info (Optional) Output quantization info |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 261 | */ |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 262 | ConvolutionLayer(unsigned int conv_width, |
| 263 | unsigned int conv_height, |
| 264 | unsigned int ofm, |
| 265 | ITensorAccessorUPtr weights, |
| 266 | ITensorAccessorUPtr bias, |
| 267 | PadStrideInfo conv_info, |
| 268 | unsigned int num_groups = 1, |
| 269 | const QuantizationInfo weights_quant_info = QuantizationInfo(), |
| 270 | const QuantizationInfo out_quant_info = QuantizationInfo()) |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 271 | : _conv_width(conv_width), |
| 272 | _conv_height(conv_height), |
| 273 | _ofm(ofm), |
| 274 | _conv_info(std::move(conv_info)), |
| 275 | _num_groups(num_groups), |
| 276 | _weights(std::move(weights)), |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 277 | _bias(std::move(bias)), |
| 278 | _weights_quant_info(std::move(weights_quant_info)), |
| 279 | _out_quant_info(std::move(out_quant_info)) |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 280 | { |
| 281 | } |
| 282 | |
| 283 | NodeID create_layer(IStream &s) override |
| 284 | { |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 285 | NodeIdxPair input = { s.tail_node(), 0 }; |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 286 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 287 | return GraphBuilder::add_convolution_node(s.graph(), common_params, input, |
Georgios Pinitas | ee33ea5 | 2018-03-08 16:01:29 +0000 | [diff] [blame] | 288 | Size2D(_conv_width, _conv_height), _ofm, _conv_info, _num_groups, |
Giorgio Arena | 59631a1 | 2018-05-02 13:59:04 +0100 | [diff] [blame] | 289 | s.hints().convolution_method_hint, s.hints().fast_math_hint, |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 290 | std::move(_weights), std::move(_bias), std::move(_weights_quant_info), std::move(_out_quant_info)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | private: |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 294 | unsigned int _conv_width; |
| 295 | unsigned int _conv_height; |
| 296 | unsigned int _ofm; |
| 297 | const PadStrideInfo _conv_info; |
| 298 | unsigned int _num_groups; |
| 299 | ITensorAccessorUPtr _weights; |
| 300 | ITensorAccessorUPtr _bias; |
| 301 | const QuantizationInfo _weights_quant_info; |
| 302 | const QuantizationInfo _out_quant_info; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 303 | }; |
| 304 | |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 305 | /** Deconvolution Layer */ |
| 306 | class DeconvolutionLayer final : public ILayer |
| 307 | { |
| 308 | public: |
| 309 | /** Construct a convolution layer. |
| 310 | * |
| 311 | * @param[in] conv_width Convolution width. |
| 312 | * @param[in] conv_height Convolution height. |
| 313 | * @param[in] ofm Output feature map. |
| 314 | * @param[in] weights Accessor to get kernel weights from. |
| 315 | * @param[in] bias Accessor to get kernel bias from. |
| 316 | * @param[in] deconv_info Padding and stride information. |
| 317 | * @param[in] inner_border Inner border padding (right, top) |
| 318 | */ |
| 319 | DeconvolutionLayer(unsigned int conv_width, |
| 320 | unsigned int conv_height, |
| 321 | unsigned int ofm, |
| 322 | ITensorAccessorUPtr weights, |
| 323 | ITensorAccessorUPtr bias, |
| 324 | PadStrideInfo deconv_info, |
| 325 | Size2D inner_border) |
| 326 | : _conv_width(conv_width), |
| 327 | _conv_height(conv_height), |
| 328 | _ofm(ofm), |
| 329 | _deconv_info(std::move(deconv_info)), |
| 330 | _inner_border(inner_border), |
| 331 | _weights(std::move(weights)), |
| 332 | _bias(std::move(bias)) |
| 333 | { |
| 334 | } |
| 335 | |
| 336 | NodeID create_layer(IStream &s) override |
| 337 | { |
| 338 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 339 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 340 | return GraphBuilder::add_deconvolution_node(s.graph(), common_params, input, |
| 341 | Size2D(_conv_width, _conv_height), _ofm, _deconv_info, _inner_border, |
| 342 | std::move(_weights), std::move(_bias)); |
| 343 | } |
| 344 | |
| 345 | private: |
| 346 | unsigned int _conv_width; |
| 347 | unsigned int _conv_height; |
| 348 | unsigned int _ofm; |
| 349 | const PadStrideInfo _deconv_info; |
| 350 | Size2D _inner_border; |
| 351 | ITensorAccessorUPtr _weights; |
| 352 | ITensorAccessorUPtr _bias; |
| 353 | }; |
| 354 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 355 | /** Depthwise Convolution Layer */ |
| 356 | class DepthwiseConvolutionLayer final : public ILayer |
| 357 | { |
| 358 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 359 | /** Construct a depthwise convolution layer. |
| 360 | * |
| 361 | * @param[in] conv_width Convolution width. |
| 362 | * @param[in] conv_height Convolution height. |
| 363 | * @param[in] weights Accessor to get kernel weights from. |
| 364 | * @param[in] bias Accessor to get kernel bias from. |
| 365 | * @param[in] conv_info Padding and stride information. |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 366 | * @param[in] quant_info (Optional) Quantization info used for weights |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 367 | */ |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 368 | DepthwiseConvolutionLayer(unsigned int conv_width, |
| 369 | unsigned int conv_height, |
| 370 | ITensorAccessorUPtr weights, |
| 371 | ITensorAccessorUPtr bias, |
| 372 | PadStrideInfo conv_info, |
| 373 | const QuantizationInfo quant_info = QuantizationInfo()) |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 374 | : _conv_width(conv_width), |
| 375 | _conv_height(conv_height), |
| 376 | _conv_info(std::move(conv_info)), |
| 377 | _weights(std::move(weights)), |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 378 | _bias(std::move(bias)), |
| 379 | _quant_info(std::move(quant_info)) |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 380 | { |
| 381 | } |
| 382 | |
| 383 | NodeID create_layer(IStream &s) override |
| 384 | { |
| 385 | NodeIdxPair input = { s.tail_node(), 0 }; |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 386 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 387 | return GraphBuilder::add_depthwise_convolution_node(s.graph(), common_params, |
| 388 | input, Size2D(_conv_width, _conv_height), _conv_info, |
| 389 | s.hints().depthwise_convolution_method_hint, |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 390 | std::move(_weights), std::move(_bias), std::move(_quant_info)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | private: |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 394 | unsigned int _conv_width; |
| 395 | unsigned int _conv_height; |
| 396 | const PadStrideInfo _conv_info; |
| 397 | ITensorAccessorUPtr _weights; |
| 398 | ITensorAccessorUPtr _bias; |
| 399 | const QuantizationInfo _quant_info; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 400 | }; |
| 401 | |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 402 | /** Dummy Layer */ |
| 403 | class DummyLayer final : public ILayer |
| 404 | { |
| 405 | public: |
| 406 | /** Construct an input layer. |
| 407 | * |
| 408 | * @param[in] shape Output shape |
| 409 | */ |
| 410 | DummyLayer(TensorShape shape) |
| 411 | : _shape(shape) |
| 412 | { |
| 413 | } |
| 414 | |
| 415 | NodeID create_layer(IStream &s) override |
| 416 | { |
| 417 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 418 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 419 | return GraphBuilder::add_dummy_node(s.graph(), common_params, input, _shape); |
| 420 | } |
| 421 | |
| 422 | private: |
| 423 | TensorShape _shape; |
| 424 | }; |
| 425 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 426 | class EltwiseLayer final : public ILayer |
| 427 | { |
| 428 | public: |
| 429 | /** Construct an element-wise operation layer |
| 430 | * |
| 431 | * @param[in] sub_stream0 First graph sub-stream |
| 432 | * @param[in] sub_stream1 First graph sub-stream |
| 433 | * @param[in] op Element-wise operation to perform |
| 434 | */ |
| 435 | EltwiseLayer(SubStream &&sub_stream0, SubStream &&sub_stream1, EltwiseOperation op) |
| 436 | : _ss0(std::move(sub_stream0)), _ss1(std::move(sub_stream1)), _op(op) |
| 437 | { |
| 438 | } |
| 439 | |
| 440 | NodeID create_layer(IStream &s) override |
| 441 | { |
| 442 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 443 | NodeIdxPair input0 = { _ss0.tail_node(), 0 }; |
| 444 | NodeIdxPair input1 = { _ss1.tail_node(), 0 }; |
| 445 | |
| 446 | return GraphBuilder::add_elementwise_node(s.graph(), common_params, input0, input1, _op); |
| 447 | } |
| 448 | |
| 449 | private: |
| 450 | SubStream _ss0; |
| 451 | SubStream _ss1; |
| 452 | EltwiseOperation _op; |
| 453 | }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 454 | /** Flatten Layer */ |
| 455 | class FlattenLayer final : public ILayer |
| 456 | { |
| 457 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 458 | /** Construct a flatten layer. */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 459 | FlattenLayer() |
| 460 | { |
| 461 | } |
| 462 | |
| 463 | NodeID create_layer(IStream &s) override |
| 464 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 465 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 466 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 467 | return GraphBuilder::add_flatten_node(s.graph(), common_params, input); |
| 468 | } |
| 469 | }; |
| 470 | |
| 471 | /** Fully Connected Layer */ |
| 472 | class FullyConnectedLayer final : public ILayer |
| 473 | { |
| 474 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 475 | /** Construct a fully connected layer. |
| 476 | * |
Georgios Pinitas | 2f1366a | 2018-07-31 16:33:06 +0100 | [diff] [blame] | 477 | * @param[in] num_outputs Number of outputs. |
| 478 | * @param[in] weights Accessor to get weights from. |
| 479 | * @param[in] bias Accessor to get bias from. |
Georgios Pinitas | c55cef1 | 2018-08-01 15:24:18 +0100 | [diff] [blame] | 480 | * @param[in] fc_info (Optional) Fully connected layer metadata |
Georgios Pinitas | 2f1366a | 2018-07-31 16:33:06 +0100 | [diff] [blame] | 481 | * @param[in] weights_quant_info (Optional) Weights quantization information |
| 482 | * @param[in] out_quant_info (Optional) Output quantization info |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 483 | */ |
Georgios Pinitas | c55cef1 | 2018-08-01 15:24:18 +0100 | [diff] [blame] | 484 | FullyConnectedLayer(unsigned int num_outputs, |
| 485 | ITensorAccessorUPtr weights, |
| 486 | ITensorAccessorUPtr bias, |
| 487 | const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(), |
| 488 | const QuantizationInfo weights_quant_info = QuantizationInfo(), |
| 489 | const QuantizationInfo out_quant_info = QuantizationInfo()) |
Georgios Pinitas | 2f1366a | 2018-07-31 16:33:06 +0100 | [diff] [blame] | 490 | : _num_outputs(num_outputs), |
| 491 | _weights(std::move(weights)), |
| 492 | _bias(std::move(bias)), |
Georgios Pinitas | c55cef1 | 2018-08-01 15:24:18 +0100 | [diff] [blame] | 493 | _fc_info(fc_info), |
Georgios Pinitas | 2f1366a | 2018-07-31 16:33:06 +0100 | [diff] [blame] | 494 | _weights_quant_info(std::move(weights_quant_info)), |
| 495 | _out_quant_info(std::move(out_quant_info)) |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 496 | { |
| 497 | } |
| 498 | |
| 499 | NodeID create_layer(IStream &s) override |
| 500 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 501 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 502 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 503 | return GraphBuilder::add_fully_connected_layer(s.graph(), common_params, input, _num_outputs, |
Georgios Pinitas | c55cef1 | 2018-08-01 15:24:18 +0100 | [diff] [blame] | 504 | std::move(_weights), std::move(_bias), _fc_info, |
Georgios Pinitas | 2f1366a | 2018-07-31 16:33:06 +0100 | [diff] [blame] | 505 | std::move(_weights_quant_info), std::move(_out_quant_info)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | private: |
Georgios Pinitas | c55cef1 | 2018-08-01 15:24:18 +0100 | [diff] [blame] | 509 | unsigned int _num_outputs; |
| 510 | ITensorAccessorUPtr _weights; |
| 511 | ITensorAccessorUPtr _bias; |
| 512 | const FullyConnectedLayerInfo _fc_info; |
| 513 | const QuantizationInfo _weights_quant_info; |
| 514 | const QuantizationInfo _out_quant_info; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 515 | }; |
| 516 | |
| 517 | /** Normalization Layer */ |
| 518 | class NormalizationLayer final : public ILayer |
| 519 | { |
| 520 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 521 | /** Construct a normalization layer. |
| 522 | * |
| 523 | * @param[in] norm_info Normalization information. |
| 524 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 525 | NormalizationLayer(NormalizationLayerInfo norm_info) |
| 526 | : _norm_info(norm_info) |
| 527 | { |
| 528 | } |
| 529 | |
| 530 | NodeID create_layer(IStream &s) override |
| 531 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 532 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 533 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 534 | return GraphBuilder::add_normalization_node(s.graph(), common_params, input, _norm_info); |
| 535 | } |
| 536 | |
| 537 | private: |
| 538 | NormalizationLayerInfo _norm_info; |
| 539 | }; |
| 540 | |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 541 | /** Normalize planar YUV Layer */ |
| 542 | class NormalizePlanarYUVLayer final : public ILayer |
| 543 | { |
| 544 | public: |
| 545 | /** Construct a normalize planar YUV layer. |
| 546 | * |
| 547 | * @param[in] mean Accessor to get mean tensor data from. |
| 548 | * @param[in] std Accessor to get std tensor data from. |
| 549 | */ |
| 550 | NormalizePlanarYUVLayer(ITensorAccessorUPtr mean, |
| 551 | ITensorAccessorUPtr std) |
| 552 | : _mean(std::move(mean)), _std(std::move(std)) |
| 553 | { |
| 554 | } |
| 555 | |
| 556 | NodeID create_layer(IStream &s) override |
| 557 | { |
| 558 | ARM_COMPUTE_ERROR_ON(_mean == nullptr); |
| 559 | ARM_COMPUTE_ERROR_ON(_std == nullptr); |
| 560 | |
| 561 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 562 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 563 | return GraphBuilder::add_normalize_planar_yuv_node(s.graph(), common_params, input, |
| 564 | std::move(_mean), std::move(_std)); |
| 565 | } |
| 566 | |
| 567 | private: |
| 568 | ITensorAccessorUPtr _mean; |
| 569 | ITensorAccessorUPtr _std; |
| 570 | }; |
| 571 | |
Michele Di Giorgio | 4bb1733 | 2018-09-26 13:56:51 +0100 | [diff] [blame] | 572 | /** Pad Layer */ |
| 573 | class PadLayer final : public ILayer |
| 574 | { |
| 575 | public: |
| 576 | /** Construct a pad layer. |
| 577 | * |
| 578 | * @param[in] padding The padding for each spatial dimension of the input tensor. The pair padding[i] |
| 579 | * specifies the front and the end padding in the i-th dimension. |
| 580 | */ |
| 581 | PadLayer(PaddingList padding) |
| 582 | : _padding(padding) |
| 583 | { |
| 584 | } |
| 585 | |
| 586 | NodeID create_layer(IStream &s) override |
| 587 | { |
| 588 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 589 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 590 | return GraphBuilder::add_pad_node(s.graph(), common_params, input, _padding); |
| 591 | } |
| 592 | |
| 593 | private: |
| 594 | PaddingList _padding; |
| 595 | }; |
| 596 | |
Georgios Pinitas | 57c4824 | 2018-08-02 13:41:49 +0100 | [diff] [blame] | 597 | /** Permute Layer */ |
| 598 | class PermuteLayer final : public ILayer |
| 599 | { |
| 600 | public: |
| 601 | /** Construct a permute layer. |
| 602 | * |
| 603 | * @param[in] perm Permutation vector. |
| 604 | * @param[in] layout (Optional) Data layout to assign to permuted tensor. |
| 605 | * If UNKNOWN then the input's layout will be used. |
| 606 | */ |
| 607 | PermuteLayer(PermutationVector perm, DataLayout layout = DataLayout::UNKNOWN) |
| 608 | : _perm(perm), _layout(layout) |
| 609 | { |
| 610 | } |
| 611 | |
| 612 | NodeID create_layer(IStream &s) override |
| 613 | { |
| 614 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 615 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 616 | return GraphBuilder::add_permute_node(s.graph(), common_params, input, _perm, _layout); |
| 617 | } |
| 618 | |
| 619 | private: |
| 620 | PermutationVector _perm; |
| 621 | DataLayout _layout; |
| 622 | }; |
| 623 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 624 | /** Pooling Layer */ |
| 625 | class PoolingLayer final : public ILayer |
| 626 | { |
| 627 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 628 | /** Construct a pooling layer. |
| 629 | * |
| 630 | * @param[in] pool_info Pooling information. |
| 631 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 632 | PoolingLayer(PoolingLayerInfo pool_info) |
| 633 | : _pool_info(pool_info) |
| 634 | { |
| 635 | } |
| 636 | |
| 637 | NodeID create_layer(IStream &s) override |
| 638 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 639 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 640 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 641 | return GraphBuilder::add_pooling_node(s.graph(), common_params, input, _pool_info); |
| 642 | } |
| 643 | |
| 644 | private: |
| 645 | PoolingLayerInfo _pool_info; |
| 646 | }; |
| 647 | |
Gian Marco Iodice | 23e2479 | 2018-09-07 15:32:14 +0100 | [diff] [blame] | 648 | /** Reorg Layer */ |
| 649 | class ReorgLayer final : public ILayer |
| 650 | { |
| 651 | public: |
| 652 | /** Construct a reorg layer. |
| 653 | * |
| 654 | * @param[in] stride Stride value to use for reorganizing the values in the output tensor. |
| 655 | * It defines the spatial distance between 2 consecutive pixels in the x and y direction |
| 656 | */ |
| 657 | ReorgLayer(int stride) |
| 658 | : _stride(stride) |
| 659 | { |
| 660 | } |
| 661 | |
| 662 | NodeID create_layer(IStream &s) override |
| 663 | { |
| 664 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 665 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 666 | return GraphBuilder::add_reorg_node(s.graph(), common_params, input, _stride); |
| 667 | } |
| 668 | |
| 669 | private: |
| 670 | int _stride; |
| 671 | }; |
| 672 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 673 | /** Reshape Layer */ |
| 674 | class ReshapeLayer final : public ILayer |
| 675 | { |
| 676 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 677 | /** Construct a reshape layer. |
| 678 | * |
| 679 | * @param[in] shape Target shape. |
| 680 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 681 | ReshapeLayer(TensorShape shape) |
| 682 | : _shape(shape) |
| 683 | { |
| 684 | } |
| 685 | |
| 686 | NodeID create_layer(IStream &s) override |
| 687 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 688 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 689 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 690 | return GraphBuilder::add_reshape_node(s.graph(), common_params, input, _shape); |
| 691 | } |
| 692 | |
| 693 | private: |
| 694 | TensorShape _shape; |
| 695 | }; |
| 696 | |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 697 | /** Resize Layer */ |
| 698 | class ResizeLayer final : public ILayer |
| 699 | { |
| 700 | public: |
| 701 | ResizeLayer(InterpolationPolicy policy, float width_scale, float height_scale) |
| 702 | : _policy(policy), _width_scale(width_scale), _height_scale(height_scale) |
| 703 | { |
| 704 | } |
| 705 | |
| 706 | NodeID create_layer(IStream &s) override |
| 707 | { |
| 708 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 709 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 710 | return GraphBuilder::add_resize_node(s.graph(), common_params, input, _policy, _width_scale, _height_scale); |
| 711 | } |
| 712 | |
| 713 | private: |
| 714 | InterpolationPolicy _policy; |
| 715 | float _width_scale; |
| 716 | float _height_scale; |
| 717 | }; |
| 718 | |
Isabella Gottardi | 88d5b22 | 2018-04-06 12:24:55 +0100 | [diff] [blame] | 719 | /** Scale Layer */ |
| 720 | class ScaleLayer final : public ILayer |
| 721 | { |
| 722 | public: |
| 723 | /** Construct a scale layer. |
| 724 | * |
| 725 | * @param[in] mul_w Accessor to get mul weight from. |
| 726 | * @param[in] add_w Accessor to get add weight from. |
| 727 | */ |
| 728 | ScaleLayer(ITensorAccessorUPtr mul_w, |
| 729 | ITensorAccessorUPtr add_w) |
| 730 | : _mul_w(std::move(mul_w)), _add_w(std::move(add_w)) |
| 731 | { |
| 732 | } |
| 733 | |
| 734 | NodeID create_layer(IStream &s) override |
| 735 | { |
| 736 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 737 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 738 | return GraphBuilder::add_scale_layer(s.graph(), common_params, input, std::move(_mul_w), std::move(_add_w)); |
| 739 | } |
| 740 | |
| 741 | private: |
| 742 | ITensorAccessorUPtr _mul_w; |
| 743 | ITensorAccessorUPtr _add_w; |
| 744 | }; |
| 745 | |
Michele Di Giorgio | c30b668 | 2018-09-12 17:44:08 +0100 | [diff] [blame] | 746 | /** Slice Layer */ |
| 747 | class SliceLayer final : public ILayer |
| 748 | { |
| 749 | public: |
| 750 | /** Construct a slice layer. |
| 751 | * |
| 752 | * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 753 | * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 754 | */ |
| 755 | SliceLayer(Coordinates &starts, Coordinates &ends) |
| 756 | : _starts(starts), _ends(ends) |
| 757 | { |
| 758 | } |
| 759 | |
| 760 | NodeID create_layer(IStream &s) override |
| 761 | { |
| 762 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 763 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 764 | return GraphBuilder::add_slice_node(s.graph(), common_params, input, _starts, _ends); |
| 765 | } |
| 766 | |
| 767 | private: |
| 768 | Coordinates _starts; |
| 769 | Coordinates _ends; |
| 770 | }; |
| 771 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 772 | /** Softmax Layer */ |
| 773 | class SoftmaxLayer final : public ILayer |
| 774 | { |
| 775 | public: |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 776 | /** Construct a softmax layer. |
| 777 | * |
| 778 | * @param[in] beta (Optional) Beta value. Default 1.0. |
| 779 | */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 780 | SoftmaxLayer(float beta = 1.0f) |
| 781 | : _beta(beta) |
| 782 | { |
| 783 | } |
| 784 | |
| 785 | NodeID create_layer(IStream &s) override |
| 786 | { |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 787 | NodeParams common_params = { name(), s.hints().target_hint }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 788 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 789 | return GraphBuilder::add_softmax_node(s.graph(), common_params, input, _beta); |
| 790 | } |
| 791 | |
| 792 | private: |
| 793 | float _beta; |
| 794 | }; |
Michalis Spyrou | 96f6769 | 2018-09-13 11:39:28 +0100 | [diff] [blame] | 795 | |
Michalis Spyrou | 4e1c3f3 | 2018-09-20 17:14:03 +0100 | [diff] [blame] | 796 | /** Upsample Layer */ |
| 797 | class UpsampleLayer final : public ILayer |
| 798 | { |
| 799 | public: |
| 800 | /** Construct a Upsample layer. |
| 801 | * |
| 802 | * @param[in] info Stride info |
| 803 | * @param[in] upsampling_policy Upsampling policy |
| 804 | */ |
| 805 | UpsampleLayer(Size2D info, InterpolationPolicy upsampling_policy) |
| 806 | : _info(info), _upsampling_policy(upsampling_policy) |
| 807 | { |
| 808 | } |
| 809 | |
| 810 | NodeID create_layer(IStream &s) override |
| 811 | { |
| 812 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 813 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 814 | return GraphBuilder::add_upsample_node(s.graph(), common_params, input, _info, _upsampling_policy); |
| 815 | } |
| 816 | |
| 817 | private: |
| 818 | Size2D _info; |
| 819 | InterpolationPolicy _upsampling_policy; |
| 820 | }; |
| 821 | |
Michalis Spyrou | 96f6769 | 2018-09-13 11:39:28 +0100 | [diff] [blame] | 822 | /** YOLO Layer */ |
| 823 | class YOLOLayer final : public ILayer |
| 824 | { |
| 825 | public: |
| 826 | /** Construct a YOLO layer. |
| 827 | * |
| 828 | * @param[in] act_info Activation info |
| 829 | * @param[in] num_classes Number of classes to activate |
| 830 | */ |
| 831 | YOLOLayer(ActivationLayerInfo act_info, int32_t num_classes) |
| 832 | : _act_info(act_info), _num_classes(num_classes) |
| 833 | { |
| 834 | } |
| 835 | |
| 836 | NodeID create_layer(IStream &s) override |
| 837 | { |
| 838 | NodeParams common_params = { name(), s.hints().target_hint }; |
| 839 | NodeIdxPair input = { s.tail_node(), 0 }; |
| 840 | return GraphBuilder::add_yolo_node(s.graph(), common_params, input, _act_info, _num_classes); |
| 841 | } |
| 842 | |
| 843 | private: |
| 844 | ActivationLayerInfo _act_info; |
| 845 | int32_t _num_classes; |
| 846 | }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 847 | } // namespace frontend |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 848 | } // namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 849 | } // namespace arm_compute |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 850 | #endif /* __ARM_COMPUTE_GRAPH_LAYERS_H__ */ |