Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 Arm Limited. |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 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 | #include "arm_compute/graph/backends/CL/CLFunctionFactory.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 25 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 26 | #include "arm_compute/graph/Graph.h" |
Gian Marco Iodice | 5dea19e | 2019-11-08 12:13:48 +0000 | [diff] [blame] | 27 | #include "arm_compute/graph/GraphContext.h" |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 28 | #include "arm_compute/graph/backends/FunctionHelpers.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 29 | #include "arm_compute/runtime/CL/CLFunctions.h" |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 30 | #include "arm_compute/runtime/CPP/CPPFunctions.h" |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 31 | #include "src/core/CL/CLKernels.h" |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 32 | #include "support/Cast.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 33 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 34 | using namespace arm_compute::utils::cast; |
| 35 | |
| 36 | namespace arm_compute |
| 37 | { |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 38 | namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 39 | { |
| 40 | namespace backends |
| 41 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 42 | /** Target specific information structure used to pass information to the layer templates */ |
| 43 | struct CLTargetInfo |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 44 | { |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 45 | using TensorType = arm_compute::ICLTensor; |
Michele Di Giorgio | f932d2c | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 46 | using SrcTensorType = const arm_compute::ICLTensor; |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 47 | using TensorConcreteType = CLTensor; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 48 | static Target TargetType; |
| 49 | }; |
| 50 | |
| 51 | Target CLTargetInfo::TargetType = Target::CL; |
| 52 | |
| 53 | /** Collection of CL convolution functions */ |
| 54 | struct CLConvolutionLayerFunctions |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 55 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 56 | using GenericConvolutionLayer = CLConvolutionLayer; |
| 57 | using GEMMConvolutionLayer = CLGEMMConvolutionLayer; |
| 58 | using DirectConvolutionLayer = CLDirectConvolutionLayer; |
| 59 | using WinogradConvolutionLayer = CLWinogradConvolutionLayer; |
| 60 | }; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 61 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 62 | /** Collection of CL element-wise functions */ |
| 63 | struct CLEltwiseFunctions |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 64 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 65 | using Addition = CLArithmeticAddition; |
| 66 | using Subtraction = CLArithmeticSubtraction; |
| 67 | using Multiplication = CLPixelWiseMultiplication; |
thecha01 | f8e3584 | 2020-07-28 17:28:17 +0100 | [diff] [blame] | 68 | using Maximum = CLElementwiseMax; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 69 | }; |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 70 | |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 71 | /** Collection of CL unary element-wise functions */ |
| 72 | struct CLUnaryEltwiseFunctions |
| 73 | { |
| 74 | using Exp = CLExpLayer; |
| 75 | }; |
| 76 | |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 77 | /** Function and tensor types to be used inside a CL fused convolution/batch normalization layer */ |
| 78 | struct CLFusedLayerTypes |
| 79 | { |
Manuel Bottini | bffb41e | 2019-06-20 16:00:27 +0100 | [diff] [blame] | 80 | using ConvolutionLayer = CLConvolutionLayer; |
| 81 | using DepthwiseConvolutionLayer = CLDepthwiseConvolutionLayer; |
| 82 | using FuseBatchNormalization = CLFuseBatchNormalization; |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 83 | }; |
| 84 | |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 85 | // TODO (isagot01): Remove once we support heterogeneous scheduling at function level |
| 86 | /** Wrapper for the CPP Function in the OpenCL backend **/ |
| 87 | class CPPWrapperFunction : public IFunction |
| 88 | { |
| 89 | public: |
| 90 | /* Default constructor */ |
| 91 | CPPWrapperFunction() |
| 92 | : _tensors(), _func(nullptr) |
| 93 | { |
| 94 | } |
| 95 | |
| 96 | void run() override |
| 97 | { |
| 98 | for(auto &tensor : _tensors) |
| 99 | { |
| 100 | tensor->map(CLScheduler::get().queue()); |
| 101 | } |
| 102 | _func->run(); |
| 103 | |
| 104 | for(auto &tensor : _tensors) |
| 105 | { |
| 106 | tensor->unmap(CLScheduler::get().queue()); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void register_tensor(ICLTensor *tensor) |
| 111 | { |
| 112 | _tensors.push_back(tensor); |
| 113 | } |
| 114 | |
| 115 | void register_function(std::unique_ptr<IFunction> function) |
| 116 | { |
| 117 | _func = std::move(function); |
| 118 | } |
| 119 | |
| 120 | private: |
| 121 | std::vector<arm_compute::ICLTensor *> _tensors; |
| 122 | std::unique_ptr<IFunction> _func; |
| 123 | }; |
| 124 | |
| 125 | namespace detail |
| 126 | { |
| 127 | // Specialized functions |
| 128 | template <> |
| 129 | std::unique_ptr<IFunction> create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(DetectionOutputLayerNode &node) |
| 130 | { |
| 131 | validate_node<CLTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */); |
| 132 | |
| 133 | // Extract IO and info |
| 134 | CLTargetInfo::TensorType *input0 = get_backing_tensor<CLTargetInfo>(node.input(0)); |
| 135 | CLTargetInfo::TensorType *input1 = get_backing_tensor<CLTargetInfo>(node.input(1)); |
| 136 | CLTargetInfo::TensorType *input2 = get_backing_tensor<CLTargetInfo>(node.input(2)); |
| 137 | CLTargetInfo::TensorType *output = get_backing_tensor<CLTargetInfo>(node.output(0)); |
| 138 | const DetectionOutputLayerInfo detect_info = node.detection_output_info(); |
| 139 | |
| 140 | ARM_COMPUTE_ERROR_ON(input0 == nullptr); |
| 141 | ARM_COMPUTE_ERROR_ON(input1 == nullptr); |
| 142 | ARM_COMPUTE_ERROR_ON(input2 == nullptr); |
| 143 | ARM_COMPUTE_ERROR_ON(output == nullptr); |
| 144 | |
| 145 | // Create and configure function |
| 146 | auto func = support::cpp14::make_unique<CPPDetectionOutputLayer>(); |
| 147 | func->configure(input0, input1, input2, output, detect_info); |
| 148 | |
| 149 | // Log info |
| 150 | ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " |
| 151 | << node.name() |
| 152 | << " Type: " << node.type() |
| 153 | << " Target: " << CLTargetInfo::TargetType |
| 154 | << " Data Type: " << input0->info()->data_type() |
| 155 | << " Input0 shape: " << input0->info()->tensor_shape() |
| 156 | << " Input1 shape: " << input1->info()->tensor_shape() |
| 157 | << " Input2 shape: " << input2->info()->tensor_shape() |
| 158 | << " Output shape: " << output->info()->tensor_shape() |
| 159 | << " DetectionOutputLayer info: " << detect_info |
| 160 | << std::endl); |
| 161 | |
| 162 | auto wrap_function = support::cpp14::make_unique<CPPWrapperFunction>(); |
Giorgio Arena | 6e9d0e0 | 2020-01-03 15:02:04 +0000 | [diff] [blame] | 163 | |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 164 | wrap_function->register_function(std::move(func)); |
| 165 | wrap_function->register_tensor(input0); |
| 166 | wrap_function->register_tensor(input1); |
| 167 | wrap_function->register_tensor(input2); |
| 168 | wrap_function->register_tensor(output); |
| 169 | |
Georgios Pinitas | 0b192e8 | 2020-02-20 17:09:28 +0000 | [diff] [blame] | 170 | return RETURN_UNIQUE_PTR(wrap_function); |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 171 | } |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 172 | template <> |
| 173 | std::unique_ptr<IFunction> create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(DetectionPostProcessLayerNode &node) |
| 174 | { |
| 175 | validate_node<CLTargetInfo>(node, 3 /* expected inputs */, 4 /* expected outputs */); |
| 176 | |
| 177 | // Extract IO and info |
| 178 | CLTargetInfo::TensorType *input0 = get_backing_tensor<CLTargetInfo>(node.input(0)); |
| 179 | CLTargetInfo::TensorType *input1 = get_backing_tensor<CLTargetInfo>(node.input(1)); |
| 180 | CLTargetInfo::TensorType *input2 = get_backing_tensor<CLTargetInfo>(node.input(2)); |
| 181 | CLTargetInfo::TensorType *output0 = get_backing_tensor<CLTargetInfo>(node.output(0)); |
| 182 | CLTargetInfo::TensorType *output1 = get_backing_tensor<CLTargetInfo>(node.output(1)); |
| 183 | CLTargetInfo::TensorType *output2 = get_backing_tensor<CLTargetInfo>(node.output(2)); |
| 184 | CLTargetInfo::TensorType *output3 = get_backing_tensor<CLTargetInfo>(node.output(3)); |
| 185 | const DetectionPostProcessLayerInfo detect_info = node.detection_post_process_info(); |
| 186 | |
| 187 | ARM_COMPUTE_ERROR_ON(input0 == nullptr); |
| 188 | ARM_COMPUTE_ERROR_ON(input1 == nullptr); |
| 189 | ARM_COMPUTE_ERROR_ON(input2 == nullptr); |
| 190 | ARM_COMPUTE_ERROR_ON(output0 == nullptr); |
| 191 | ARM_COMPUTE_ERROR_ON(output1 == nullptr); |
| 192 | ARM_COMPUTE_ERROR_ON(output2 == nullptr); |
| 193 | ARM_COMPUTE_ERROR_ON(output3 == nullptr); |
| 194 | |
| 195 | // Create and configure function |
| 196 | auto func = support::cpp14::make_unique<CPPDetectionPostProcessLayer>(); |
| 197 | func->configure(input0, input1, input2, output0, output1, output2, output3, detect_info); |
| 198 | |
| 199 | // Log info |
| 200 | ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " |
| 201 | << node.name() |
| 202 | << " Type: " << node.type() |
| 203 | << " Target: " << CLTargetInfo::TargetType |
| 204 | << " Data Type: " << input0->info()->data_type() |
| 205 | << " Input0 shape: " << input0->info()->tensor_shape() |
| 206 | << " Input1 shape: " << input1->info()->tensor_shape() |
| 207 | << " Input2 shape: " << input2->info()->tensor_shape() |
| 208 | << " Output0 shape: " << output0->info()->tensor_shape() |
| 209 | << " Output1 shape: " << output1->info()->tensor_shape() |
| 210 | << " Output2 shape: " << output2->info()->tensor_shape() |
| 211 | << " Output3 shape: " << output3->info()->tensor_shape() |
| 212 | << " DetectionPostProcessLayer info: " << detect_info |
| 213 | << std::endl); |
| 214 | |
| 215 | auto wrap_function = support::cpp14::make_unique<CPPWrapperFunction>(); |
| 216 | |
| 217 | wrap_function->register_function(std::move(func)); |
| 218 | wrap_function->register_tensor(input0); |
| 219 | wrap_function->register_tensor(input1); |
| 220 | wrap_function->register_tensor(input2); |
| 221 | wrap_function->register_tensor(output0); |
| 222 | wrap_function->register_tensor(output1); |
| 223 | wrap_function->register_tensor(output2); |
| 224 | wrap_function->register_tensor(output3); |
| 225 | |
Georgios Pinitas | 0b192e8 | 2020-02-20 17:09:28 +0000 | [diff] [blame] | 226 | return RETURN_UNIQUE_PTR(wrap_function); |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 227 | } |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 228 | } // namespace detail |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 229 | |
| 230 | std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext &ctx) |
| 231 | { |
| 232 | if(node == nullptr) |
| 233 | { |
| 234 | return nullptr; |
| 235 | } |
| 236 | |
| 237 | NodeType type = node->type(); |
| 238 | switch(type) |
| 239 | { |
| 240 | case NodeType::ActivationLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 241 | return detail::create_activation_layer<CLActivationLayer, CLTargetInfo>(*polymorphic_downcast<ActivationLayerNode *>(node)); |
thecha01 | e8f05da | 2020-08-24 17:21:41 +0100 | [diff] [blame] | 242 | case NodeType::ArgMinMaxLayer: |
| 243 | return detail::create_arg_min_max_layer<CLArgMinMaxLayer, CLTargetInfo>(*polymorphic_downcast<ArgMinMaxLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 244 | case NodeType::BatchNormalizationLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 245 | return detail::create_batch_normalization_layer<CLBatchNormalizationLayer, CLTargetInfo>(*polymorphic_downcast<BatchNormalizationLayerNode *>(node)); |
Manuel Bottini | d2048ce | 2018-10-23 17:00:42 +0100 | [diff] [blame] | 246 | case NodeType::BoundingBoxTransformLayer: |
| 247 | return detail::create_bounding_box_transform_layer<CLBoundingBoxTransform, CLTargetInfo>(*polymorphic_downcast<BoundingBoxTransformLayerNode *>(node)); |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 248 | case NodeType::ChannelShuffleLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 249 | return detail::create_channel_shuffle_layer<CLChannelShuffleLayer, CLTargetInfo>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 250 | case NodeType::ConvolutionLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 251 | return detail::create_convolution_layer<CLConvolutionLayerFunctions, CLTargetInfo>(*polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 252 | case NodeType::DeconvolutionLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 253 | return detail::create_deconvolution_layer<CLDeconvolutionLayer, CLTargetInfo>(*polymorphic_downcast<DeconvolutionLayerNode *>(node), ctx); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 254 | case NodeType::ConcatenateLayer: |
| 255 | return detail::create_concatenate_layer<CLConcatenateLayer, CLTargetInfo>(*polymorphic_downcast<ConcatenateLayerNode *>(node)); |
thecha01 | 0a05e6a | 2020-08-28 18:40:38 +0100 | [diff] [blame] | 256 | case NodeType::DepthToSpaceLayer: |
| 257 | return detail::create_depth_to_space_layer<CLDepthToSpaceLayer, CLTargetInfo>(*polymorphic_downcast<DepthToSpaceLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 258 | case NodeType::DepthwiseConvolutionLayer: |
Manuel Bottini | 05069f0 | 2019-09-26 17:18:26 +0100 | [diff] [blame] | 259 | return detail::create_depthwise_convolution_layer<CLDepthwiseConvolutionLayer, CLTargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); |
Isabella Gottardi | cd4e9ab | 2019-11-05 17:50:27 +0000 | [diff] [blame] | 260 | case NodeType::DequantizationLayer: |
| 261 | return detail::create_dequantization_layer<CLDequantizationLayer, CLTargetInfo>(*polymorphic_downcast<DequantizationLayerNode *>(node)); |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 262 | case NodeType::DetectionOutputLayer: |
| 263 | return detail::create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 264 | case NodeType::DetectionPostProcessLayer: |
| 265 | return detail::create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 266 | case NodeType::EltwiseLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 267 | return detail::create_eltwise_layer<CLEltwiseFunctions, CLTargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 268 | case NodeType::UnaryEltwiseLayer: |
| 269 | return detail::create_unary_eltwise_layer<CLUnaryEltwiseFunctions, CLTargetInfo>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 270 | case NodeType::FlattenLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 271 | return detail::create_flatten_layer<CLFlattenLayer, CLTargetInfo>(*polymorphic_downcast<FlattenLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 272 | case NodeType::FullyConnectedLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 273 | return detail::create_fully_connected_layer<CLFullyConnectedLayer, CLTargetInfo>(*polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 274 | case NodeType::FusedConvolutionBatchNormalizationLayer: |
Gian Marco Iodice | 5dea19e | 2019-11-08 12:13:48 +0000 | [diff] [blame] | 275 | return detail::create_fused_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>(*polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node), ctx); |
Manuel Bottini | bffb41e | 2019-06-20 16:00:27 +0100 | [diff] [blame] | 276 | case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer: |
Gian Marco Iodice | 5dea19e | 2019-11-08 12:13:48 +0000 | [diff] [blame] | 277 | return detail::create_fused_depthwise_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>(*polymorphic_downcast<FusedDepthwiseConvolutionBatchNormalizationNode *>(node), ctx); |
Manuel Bottini | 5209be5 | 2019-02-13 16:34:56 +0000 | [diff] [blame] | 278 | case NodeType::GenerateProposalsLayer: |
| 279 | return detail::create_generate_proposals_layer<CLGenerateProposalsLayer, CLTargetInfo>(*polymorphic_downcast<GenerateProposalsLayerNode *>(node), ctx); |
thecha01 | 3603aff | 2020-09-01 14:52:38 +0100 | [diff] [blame] | 280 | case NodeType::L2NormalizeLayer: |
| 281 | return detail::create_l2_normalize_layer<CLL2NormalizeLayer, CLTargetInfo>(*polymorphic_downcast<L2NormalizeLayerNode *>(node), ctx); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 282 | case NodeType::NormalizationLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 283 | return detail::create_normalization_layer<CLNormalizationLayer, CLTargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx); |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 284 | case NodeType::NormalizePlanarYUVLayer: |
| 285 | return detail::create_normalize_planar_yuv_layer<CLNormalizePlanarYUVLayer, CLTargetInfo>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); |
Michele Di Giorgio | 4bb1733 | 2018-09-26 13:56:51 +0100 | [diff] [blame] | 286 | case NodeType::PadLayer: |
| 287 | return detail::create_pad_layer<CLPadLayer, CLTargetInfo>(*polymorphic_downcast<PadLayerNode *>(node)); |
Georgios Pinitas | 57c4824 | 2018-08-02 13:41:49 +0100 | [diff] [blame] | 288 | case NodeType::PermuteLayer: |
| 289 | return detail::create_permute_layer<CLPermute, CLTargetInfo>(*polymorphic_downcast<PermuteLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 290 | case NodeType::PoolingLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 291 | return detail::create_pooling_layer<CLPoolingLayer, CLTargetInfo>(*polymorphic_downcast<PoolingLayerNode *>(node)); |
Georgios Pinitas | f8c4749 | 2020-02-04 17:39:59 +0000 | [diff] [blame] | 292 | case NodeType::PReluLayer: |
| 293 | return detail::create_prelu_layer<CLPReluLayer, CLTargetInfo>(*polymorphic_downcast<PReluLayerNode *>(node)); |
Giorgio Arena | 6e9d0e0 | 2020-01-03 15:02:04 +0000 | [diff] [blame] | 294 | case NodeType::PrintLayer: |
| 295 | return detail::create_print_layer<CLTargetInfo>(*polymorphic_downcast<PrintLayerNode *>(node)); |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 296 | case NodeType::PriorBoxLayer: |
| 297 | return detail::create_priorbox_layer<CLPriorBoxLayer, CLTargetInfo>(*polymorphic_downcast<PriorBoxLayerNode *>(node)); |
Isabella Gottardi | 3db1ba9 | 2019-05-17 12:35:20 +0100 | [diff] [blame] | 298 | case NodeType::QuantizationLayer: |
| 299 | return detail::create_quantization_layer<CLQuantizationLayer, CLTargetInfo>(*polymorphic_downcast<QuantizationLayerNode *>(node)); |
thecha01 | d64444b | 2020-09-07 14:50:21 +0100 | [diff] [blame] | 300 | case NodeType::ReductionOperationLayer: |
| 301 | return detail::create_reduction_operation_layer<CLReductionOperation, CLTargetInfo>(*polymorphic_downcast<ReductionLayerNode *>(node), ctx); |
Gian Marco Iodice | 23e2479 | 2018-09-07 15:32:14 +0100 | [diff] [blame] | 302 | case NodeType::ReorgLayer: |
| 303 | return detail::create_reorg_layer<CLReorgLayer, CLTargetInfo>(*polymorphic_downcast<ReorgLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 304 | case NodeType::ReshapeLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 305 | return detail::create_reshape_layer<CLReshapeLayer, CLTargetInfo>(*polymorphic_downcast<ReshapeLayerNode *>(node)); |
Georgios Pinitas | 087eaf6 | 2018-05-16 15:52:35 +0100 | [diff] [blame] | 306 | case NodeType::ResizeLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 307 | return detail::create_resize_layer<CLScale, CLTargetInfo>(*polymorphic_downcast<ResizeLayerNode *>(node)); |
Manuel Bottini | 3f9d4d7 | 2018-10-19 14:04:42 +0100 | [diff] [blame] | 308 | case NodeType::ROIAlignLayer: |
| 309 | return detail::create_roi_align_layer<CLROIAlignLayer, CLTargetInfo>(*polymorphic_downcast<ROIAlignLayerNode *>(node)); |
Michele Di Giorgio | c30b668 | 2018-09-12 17:44:08 +0100 | [diff] [blame] | 310 | case NodeType::SliceLayer: |
| 311 | return detail::create_slice_layer<CLSlice, CLTargetInfo>(*polymorphic_downcast<SliceLayerNode *>(node)); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 312 | case NodeType::SoftmaxLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 313 | return detail::create_softmax_layer<CLSoftmaxLayer, CLTargetInfo>(*polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); |
Michele Di Giorgio | ec69975 | 2019-03-22 15:25:32 +0000 | [diff] [blame] | 314 | case NodeType::StackLayer: |
| 315 | return detail::create_stack_layer<CLStackLayer, CLTargetInfo>(*polymorphic_downcast<StackLayerNode *>(node)); |
thecha01 | 2bfadd9 | 2020-08-12 17:25:51 +0100 | [diff] [blame] | 316 | case NodeType::StridedSliceLayer: |
| 317 | return detail::create_strided_slice_layer<CLStridedSlice, CLTargetInfo>(*polymorphic_downcast<StridedSliceLayerNode *>(node)); |
Michalis Spyrou | 4e1c3f3 | 2018-09-20 17:14:03 +0100 | [diff] [blame] | 318 | case NodeType::UpsampleLayer: |
| 319 | return detail::create_upsample_layer<CLUpsampleLayer, CLTargetInfo>(*polymorphic_downcast<UpsampleLayerNode *>(node), ctx); |
Michalis Spyrou | 96f6769 | 2018-09-13 11:39:28 +0100 | [diff] [blame] | 320 | case NodeType::YOLOLayer: |
| 321 | return detail::create_yolo_layer<CLYOLOLayer, CLTargetInfo>(*polymorphic_downcast<YOLOLayerNode *>(node), ctx); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 322 | default: |
| 323 | return nullptr; |
| 324 | } |
| 325 | } |
| 326 | } // namespace backends |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 327 | } // namespace graph |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 328 | } // namespace arm_compute |