| 188 | } |
| 189 | |
| 190 | ConvolutionMethod ClConv2d::get_convolution_method(const ITensorInfo *src, |
| 191 | const ITensorInfo *weights, |
| 192 | const ITensorInfo *dst, |
| 193 | const Conv2dInfo &conv2d_info, |
| 194 | const WeightsInfo &weights_info, |
| 195 | const GPUTarget gpu_target) |
| 196 | { |
| 197 | ARM_COMPUTE_ERROR_ON_NULLPTR(src); |
| 198 | ARM_COMPUTE_ERROR_ON_NULLPTR(dst); |
| 199 | ARM_COMPUTE_ERROR_ON_NULLPTR(weights); |
| 200 | ARM_COMPUTE_UNUSED(weights_info); |
| 201 | |
| 202 | const PadStrideInfo conv_info = conv2d_info.conv_info; |
| 203 | const ActivationLayerInfo act_info = conv2d_info.act_info; |
| 204 | const Size2D dilation = conv2d_info.dilation; |
| 205 | bool enable_fast_math = conv2d_info.enable_fast_math; |
| 206 | |
| 207 | const size_t idx_w = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::WIDTH); |
| 208 | const size_t idx_h = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::HEIGHT); |
| 209 | const size_t idx_c = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::CHANNEL); |
| 210 | |
| 211 | /* Input spatial dims, kernel size, IFM/OFM, conv info*/ |
| 212 | using ConvolutionConfiguration = std::tuple<Size2D, Size2D, Size2D, PadStrideInfo, DataLayout>; |
| 213 | using ConfigurationMethod = std::pair<ConvolutionConfiguration, ConvolutionMethod>; |
| 214 | |
| 215 | const std::vector<ConfigurationMethod> known_configs = { |
| 216 | // Alexnet |
| 217 | ConfigurationMethod(ConvolutionConfiguration(Size2D(27U, 27U), Size2D(5U, 5U), Size2D(48U, 128U), |
| 218 | PadStrideInfo(1U, 1U, 2U, 2U), DataLayout::NCHW), |
| 219 | ConvolutionMethod::DIRECT), |
| 220 | // VGG16 / VGG19 |
| 221 | ConfigurationMethod(ConvolutionConfiguration(Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 64U), |
| 222 | PadStrideInfo(1U, 1U, 1U, 1U), DataLayout::NCHW), |
| 223 | ConvolutionMethod::DIRECT), |
| 224 | // Mobilenet 224 |
| 225 | ConfigurationMethod(ConvolutionConfiguration( |
| 226 | Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 32U), |
| 227 | PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NCHW), |
| 228 | ConvolutionMethod::GEMM), |
| 229 | // Mobilenet 160 |
| 230 | ConfigurationMethod(ConvolutionConfiguration( |
| 231 | Size2D(160U, 160U), Size2D(3U, 3U), Size2D(3U, 24U), |
| 232 | PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NCHW), |
| 233 | ConvolutionMethod::GEMM), |
| 234 | // Mobilenet 224 |
| 235 | ConfigurationMethod(ConvolutionConfiguration( |
| 236 | Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 32U), |
| 237 | PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NHWC), |
| 238 | ConvolutionMethod::GEMM), |
| 239 | // Mobilenet 160 |
| 240 | ConfigurationMethod(ConvolutionConfiguration( |
| 241 | Size2D(160U, 160U), Size2D(3U, 3U), Size2D(3U, 24U), |
| 242 | PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NHWC), |
| 243 | ConvolutionMethod::GEMM), |
| 244 | }; |
| 245 | |
| 246 | const auto find_config = [&](ConfigurationMethod c) |
| 247 | { |
nothing calls this directly
no test coverage detected