| 294 | } // namespace |
| 295 | |
| 296 | void CpuIm2ColKernel::configure(const ITensorInfo *src, |
| 297 | ITensorInfo *dst, |
| 298 | const Size2D &kernel_dims, |
| 299 | const PadStrideInfo &conv_info, |
| 300 | bool has_bias, |
| 301 | const Size2D &dilation, |
| 302 | unsigned int num_groups, |
| 303 | unsigned int channel_pad_right) |
| 304 | { |
| 305 | ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuIm2ColKernel::configure"); |
| 306 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); |
| 307 | ARM_COMPUTE_ERROR_THROW_ON( |
| 308 | validate_arguments(src, dst, kernel_dims, conv_info, has_bias, dilation, num_groups, channel_pad_right)); |
| 309 | |
| 310 | _data_layout = src->data_layout(); |
| 311 | const unsigned int width_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH); |
| 312 | const unsigned int height_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT); |
| 313 | const unsigned int channel_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::CHANNEL); |
| 314 | |
| 315 | _conv_info = conv_info; |
| 316 | _kernel_width = kernel_dims.width; |
| 317 | _kernel_height = kernel_dims.height; |
| 318 | _channel_pad_right = channel_pad_right; |
| 319 | _dilation = dilation; |
| 320 | _convolved_dims = scaled_dimensions(src->dimension(width_idx), src->dimension(height_idx), _kernel_width, |
| 321 | _kernel_height, _conv_info, _dilation); |
| 322 | _has_bias = has_bias; |
| 323 | |
| 324 | if (_data_layout == DataLayout::NCHW) |
| 325 | { |
| 326 | switch (src->data_type()) |
| 327 | { |
| 328 | case DataType::F32: |
| 329 | _func = (!conv_info.has_padding()) ? &run_im2col_fp32_nchw_nopad : &run_im2col_fp32_nchw_pad; |
| 330 | break; |
| 331 | case DataType::F16: |
| 332 | _func = (!conv_info.has_padding()) ? &internal_run_im2col_fp16_nchw_nopad |
| 333 | : &internal_run_im2col_fp16_nchw_pad; |
| 334 | break; |
| 335 | #if defined(ARM_COMPUTE_ENABLE_BF16) |
| 336 | case DataType::BFLOAT16: |
| 337 | _func = (!conv_info.has_padding()) ? &run_im2col_bf16_nchw_nopad : &run_im2col_bf16_nchw_pad; |
| 338 | break; |
| 339 | #endif /* defined(ARM_COMPUTE_ENABLE_BF16) */ |
| 340 | case DataType::QASYMM8_SIGNED: |
| 341 | case DataType::QASYMM8: |
| 342 | _func = (!conv_info.has_padding()) ? &run_im2col_qasymm8_nchw_nopad : &run_im2col_qasymm8_nchw_pad; |
| 343 | break; |
| 344 | default: |
| 345 | ARM_COMPUTE_ERROR("Data type not supported"); |
| 346 | break; |
| 347 | } |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | switch (src->data_type()) |
| 352 | { |
| 353 | case DataType::F32: |
nothing calls this directly
no test coverage detected