Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [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 | fbb8054 | 2018-03-27 17:15:49 +0100 | [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/GLES/GCFunctionFactory.h" |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 25 | |
| 26 | #include "arm_compute/core/utils/misc/Cast.h" |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 27 | #include "arm_compute/graph/Graph.h" |
Gian Marco Iodice | 5dea19e | 2019-11-08 12:13:48 +0000 | [diff] [blame] | 28 | #include "arm_compute/graph/GraphContext.h" |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 29 | #include "arm_compute/graph/backends/FunctionHelpers.h" |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 30 | #include "arm_compute/runtime/GLES_COMPUTE/GCFunctions.h" |
| 31 | |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 32 | using namespace arm_compute::utils::cast; |
| 33 | |
| 34 | namespace arm_compute |
| 35 | { |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 36 | namespace graph |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 37 | { |
| 38 | namespace backends |
| 39 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 40 | /** Target specific information structure used to pass information to the layer templates */ |
| 41 | struct GCTargetInfo |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 42 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 43 | using TensorType = arm_compute::IGCTensor; |
| 44 | static Target TargetType; |
| 45 | }; |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 46 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 47 | Target GCTargetInfo::TargetType = Target::GC; |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 48 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 49 | /** Collection of GC convolution functions */ |
| 50 | struct GCConvolutionLayerFunctions |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 51 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 52 | using GenericConvolutionLayer = GCConvolutionLayer; |
| 53 | using GEMMConvolutionLayer = GCConvolutionLayer; |
| 54 | using DirectConvolutionLayer = GCDirectConvolutionLayer; |
| 55 | }; |
| 56 | |
| 57 | /** Collection of GC depthwise convolution functions */ |
| 58 | struct GCDepthwiseConvolutionLayerFunctions |
| 59 | { |
| 60 | using DepthwiseConvolutionLayer3x3 = GCDepthwiseConvolutionLayer3x3; |
| 61 | }; |
| 62 | |
| 63 | /** Collection of GC element-wise functions */ |
| 64 | struct GCEltwiseFunctions |
| 65 | { |
| 66 | using Addition = GCArithmeticAddition; |
| 67 | using Multiplication = GCPixelWiseMultiplication; |
| 68 | }; |
| 69 | |
| 70 | namespace detail |
| 71 | { |
| 72 | template <> |
| 73 | std::unique_ptr<IFunction> create_convolution_layer<GCConvolutionLayerFunctions, GCTargetInfo>(ConvolutionLayerNode &node, GraphContext &ctx) |
| 74 | { |
| 75 | validate_node<GCTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 76 | |
| 77 | // Extract IO and info |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 78 | GCTargetInfo::TensorType *input = get_backing_tensor<GCTargetInfo>(node.input(0)); |
| 79 | GCTargetInfo::TensorType *weights = get_backing_tensor<GCTargetInfo>(node.input(1)); |
| 80 | GCTargetInfo::TensorType *biases = get_backing_tensor<GCTargetInfo>(node.input(2)); |
| 81 | GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0)); |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 82 | |
| 83 | if(is_data_type_quantized_asymmetric(input->info()->data_type())) |
| 84 | { |
| 85 | biases->info()->set_data_type(DataType::S32); |
| 86 | } |
| 87 | |
Georgios Pinitas | 08346e9 | 2018-10-16 19:10:46 +0100 | [diff] [blame] | 88 | const PadStrideInfo conv_info = node.convolution_info(); |
| 89 | const ConvolutionMethod conv_algorithm = node.convolution_method(); |
| 90 | const ActivationLayerInfo fused_act = node.fused_activation(); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 91 | |
| 92 | // Create and configure function (we assume that functions have been validated before creation) |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 93 | std::shared_ptr<IMemoryManager> mm = get_memory_manager(ctx, GCTargetInfo::TargetType); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 94 | std::unique_ptr<IFunction> func; |
| 95 | std::string func_name; |
| 96 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 97 | if(conv_algorithm == ConvolutionMethod::Direct) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 98 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 99 | std::tie(func, func_name) = create_named_function<GCConvolutionLayerFunctions::DirectConvolutionLayer>( |
| 100 | std::string("DirectConvolutionLayer"), |
Georgios Pinitas | 08346e9 | 2018-10-16 19:10:46 +0100 | [diff] [blame] | 101 | input, weights, biases, output, conv_info, fused_act); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 102 | } |
| 103 | else |
| 104 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 105 | std::tie(func, func_name) = create_named_memory_managed_function<GCConvolutionLayerFunctions::GenericConvolutionLayer>( |
| 106 | std::string("ConvolutionLayer"), mm, |
Georgios Pinitas | 08346e9 | 2018-10-16 19:10:46 +0100 | [diff] [blame] | 107 | input, weights, biases, output, conv_info, WeightsInfo(), Size2D(1U, 1U), fused_act); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | // Log info |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 111 | ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " |
| 112 | << node.name() |
| 113 | << " Type: " << func_name |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 114 | << " Data Type: " << input->info()->data_type() |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 115 | << " Input QuantInfo: " << input->info()->quantization_info() |
| 116 | << " Weights QuantInfo: " << weights->info()->quantization_info() |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 117 | << " Input shape: " << input->info()->tensor_shape() |
| 118 | << " Weights shape: " << weights->info()->tensor_shape() |
| 119 | << " Output shape: " << output->info()->tensor_shape() |
Georgios Pinitas | 08346e9 | 2018-10-16 19:10:46 +0100 | [diff] [blame] | 120 | << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 121 | << std::endl); |
| 122 | return func; |
| 123 | } |
| 124 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 125 | template <> |
| 126 | std::unique_ptr<IFunction> create_depthwise_convolution_layer<GCDepthwiseConvolutionLayerFunctions, GCTargetInfo>(DepthwiseConvolutionLayerNode &node) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 127 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 128 | validate_node<GCTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 129 | |
| 130 | // Extract IO and info |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 131 | GCTargetInfo::TensorType *input = get_backing_tensor<GCTargetInfo>(node.input(0)); |
| 132 | GCTargetInfo::TensorType *weights = get_backing_tensor<GCTargetInfo>(node.input(1)); |
| 133 | GCTargetInfo::TensorType *biases = get_backing_tensor<GCTargetInfo>(node.input(2)); |
| 134 | GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0)); |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 135 | |
| 136 | if(is_data_type_quantized_asymmetric(input->info()->data_type())) |
| 137 | { |
| 138 | biases->info()->set_data_type(DataType::S32); |
| 139 | } |
| 140 | |
Georgios Pinitas | 60e9825 | 2018-10-22 16:17:20 +0100 | [diff] [blame] | 141 | const PadStrideInfo conv_info = node.convolution_info(); |
| 142 | const DepthwiseConvolutionMethod dwc_algorithm = node.depthwise_convolution_method(); |
Georgios Pinitas | 60e9825 | 2018-10-22 16:17:20 +0100 | [diff] [blame] | 143 | const ActivationLayerInfo fused_act = node.fused_activation(); |
Georgios Pinitas | 05045c1 | 2018-12-07 18:31:47 +0000 | [diff] [blame] | 144 | const int depth_multiplier = node.depth_multiplier(); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 145 | |
| 146 | // Create and configure function (we assume that functions have been validated before creation) |
| 147 | std::unique_ptr<IFunction> func; |
| 148 | std::string func_name; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 149 | if(dwc_algorithm == DepthwiseConvolutionMethod::Optimized3x3) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 150 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 151 | std::tie(func, func_name) = create_named_function<GCDepthwiseConvolutionLayerFunctions::DepthwiseConvolutionLayer3x3>( |
| 152 | std::string("DepthwiseConvolutionLayer3x3"), |
Georgios Pinitas | 60e9825 | 2018-10-22 16:17:20 +0100 | [diff] [blame] | 153 | input, weights, biases, output, conv_info, depth_multiplier, fused_act); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 154 | } |
| 155 | else |
| 156 | { |
| 157 | ARM_COMPUTE_ERROR("Generic DepthwiseConvolutionLayer is not supported in GLES backend"); |
| 158 | } |
| 159 | |
| 160 | // Log info |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 161 | ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " |
| 162 | << node.name() |
| 163 | << " Type: " << func_name |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 164 | << " Target " << GCTargetInfo::TargetType |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 165 | << " Data Type: " << input->info()->data_type() |
Giorgio Arena | bb54e4e | 2018-04-05 17:20:34 +0100 | [diff] [blame] | 166 | << " Input QuantInfo: " << input->info()->quantization_info() |
| 167 | << " Weights QuantInfo: " << weights->info()->quantization_info() |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 168 | << " Input shape: " << input->info()->tensor_shape() |
| 169 | << " Weights shape: " << weights->info()->tensor_shape() |
| 170 | << " Output shape: " << output->info()->tensor_shape() |
Georgios Pinitas | 05045c1 | 2018-12-07 18:31:47 +0000 | [diff] [blame] | 171 | << " Depth multiplier: " << depth_multiplier |
Georgios Pinitas | 60e9825 | 2018-10-22 16:17:20 +0100 | [diff] [blame] | 172 | << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 173 | << std::endl); |
| 174 | return func; |
| 175 | } |
| 176 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 177 | template <> |
| 178 | std::unique_ptr<IFunction> create_eltwise_layer<GCEltwiseFunctions, GCTargetInfo>(EltwiseLayerNode &node) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 179 | { |
| 180 | ARM_COMPUTE_LOG_GRAPH_VERBOSE( |
| 181 | "Creating GC EltwiseLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl); |
| 182 | ARM_COMPUTE_ERROR_ON(node.num_inputs() != 2); |
| 183 | ARM_COMPUTE_ERROR_ON(node.num_outputs() != 1); |
| 184 | |
| 185 | // Extract IO and info |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 186 | GCTargetInfo::TensorType *input1 = get_backing_tensor<GCTargetInfo>(node.input(0)); |
| 187 | GCTargetInfo::TensorType *input2 = get_backing_tensor<GCTargetInfo>(node.input(1)); |
| 188 | GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0)); |
| 189 | const EltwiseOperation eltwise_op = node.eltwise_operation(); |
| 190 | const ConvertPolicy convert_policy = node.convert_policy(); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 191 | ARM_COMPUTE_ERROR_ON(input1 == nullptr); |
| 192 | ARM_COMPUTE_ERROR_ON(input2 == nullptr); |
| 193 | ARM_COMPUTE_ERROR_ON(output == nullptr); |
| 194 | |
| 195 | std::unique_ptr<IFunction> func = nullptr; |
| 196 | std::string func_name; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 197 | if(eltwise_op == EltwiseOperation::Add) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 198 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 199 | std::tie(func, func_name) = create_named_function<GCEltwiseFunctions::Addition>( |
| 200 | std::string("GCArithmeticAddition"), |
| 201 | input1, input2, output, convert_policy); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 202 | } |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 203 | else if(eltwise_op == EltwiseOperation::Sub) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 204 | { |
| 205 | ARM_COMPUTE_ERROR("Arithmetic subtraction is not supported in GLES backend"); |
| 206 | } |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 207 | else if(eltwise_op == EltwiseOperation::Mul) |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 208 | { |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 209 | std::tie(func, func_name) = create_named_function<GCEltwiseFunctions::Multiplication>( |
| 210 | std::string("PixelWiseMultiplication"), |
| 211 | input1, input2, output, 1.f); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 212 | } |
| 213 | else |
| 214 | { |
| 215 | ARM_COMPUTE_ERROR("Unsupported element-wise operation!"); |
| 216 | } |
| 217 | |
| 218 | // Log info |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 219 | ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " |
| 220 | << node.name() |
| 221 | << " Type: " << node.type() |
| 222 | << " Target: " << GCTargetInfo::TargetType |
| 223 | << " Operation: " << func_name |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 224 | << " Data Type: " << input1->info()->data_type() |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 225 | << " Shape: " << input1->info()->tensor_shape() |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 226 | << std::endl); |
| 227 | |
| 228 | return func; |
| 229 | } |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 230 | } //namespace detail |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 231 | |
| 232 | std::unique_ptr<IFunction> GCFunctionFactory::create(INode *node, GraphContext &ctx) |
| 233 | { |
| 234 | if(node == nullptr) |
| 235 | { |
| 236 | return nullptr; |
| 237 | } |
| 238 | |
| 239 | NodeType type = node->type(); |
| 240 | switch(type) |
| 241 | { |
| 242 | case NodeType::ActivationLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 243 | return detail::create_activation_layer<GCActivationLayer, GCTargetInfo>(*polymorphic_downcast<ActivationLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [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<GCBatchNormalizationLayer, GCTargetInfo>(*polymorphic_downcast<BatchNormalizationLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 246 | case NodeType::ConvolutionLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 247 | return detail::create_convolution_layer<GCConvolutionLayerFunctions, GCTargetInfo>(*polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 248 | case NodeType::ConcatenateLayer: |
Georgios Pinitas | 09f2497 | 2019-05-17 18:14:40 +0100 | [diff] [blame] | 249 | return detail::create_concatenate_layer<GCConcatenateLayer, GCTargetInfo>(*polymorphic_downcast<ConcatenateLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 250 | case NodeType::DepthwiseConvolutionLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 251 | return detail::create_depthwise_convolution_layer<GCDepthwiseConvolutionLayerFunctions, GCTargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 252 | case NodeType::EltwiseLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 253 | return detail::create_eltwise_layer<GCEltwiseFunctions, GCTargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 254 | case NodeType::FullyConnectedLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 255 | return detail::create_fully_connected_layer<GCFullyConnectedLayer, GCTargetInfo>(*polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 256 | case NodeType::NormalizationLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 257 | return detail::create_normalization_layer<GCNormalizationLayer, GCTargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx); |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 258 | case NodeType::NormalizePlanarYUVLayer: |
| 259 | return detail::create_normalize_planar_yuv_layer<GCNormalizePlanarYUVLayer, GCTargetInfo>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 260 | case NodeType::PoolingLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 261 | return detail::create_pooling_layer<GCPoolingLayer, GCTargetInfo>(*polymorphic_downcast<PoolingLayerNode *>(node)); |
Giorgio Arena | 6e9d0e0 | 2020-01-03 15:02:04 +0000 | [diff] [blame] | 262 | case NodeType::PrintLayer: |
| 263 | return detail::create_print_layer<GCTargetInfo>(*polymorphic_downcast<PrintLayerNode *>(node)); |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 264 | case NodeType::ResizeLayer: |
| 265 | return detail::create_resize_layer<GCScale, GCTargetInfo>(*polymorphic_downcast<ResizeLayerNode *>(node)); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 266 | case NodeType::SoftmaxLayer: |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 267 | return detail::create_softmax_layer<GCSoftmaxLayer, GCTargetInfo>(*polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); |
Georgios Pinitas | fbb8054 | 2018-03-27 17:15:49 +0100 | [diff] [blame] | 268 | default: |
| 269 | return nullptr; |
| 270 | } |
| 271 | } |
| 272 | } // namespace backends |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 273 | } // namespace graph |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 274 | } // namespace arm_compute |