| 78 | ClConv2d::~ClConv2d() = default; |
| 79 | |
| 80 | void ClConv2d::configure(const CLCompileContext &compile_context, |
| 81 | ITensorInfo *src, |
| 82 | ITensorInfo *weights, |
| 83 | ITensorInfo *biases, |
| 84 | ITensorInfo *dst, |
| 85 | const Conv2dInfo &conv2d_info, |
| 86 | const WeightsInfo &weights_info) |
| 87 | { |
| 88 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, weights, dst); |
| 89 | ARM_COMPUTE_ERROR_THROW_ON( |
| 90 | ClConv2d::validate(src, weights, ((biases != nullptr) ? biases : nullptr), dst, conv2d_info, weights_info)); |
| 91 | ARM_COMPUTE_LOG_PARAMS(src, weights, biases, dst, conv2d_info, weights_info); |
| 92 | |
| 93 | switch (ClConv2d::get_convolution_method(src, weights, dst, conv2d_info, weights_info, CLScheduler::get().target())) |
| 94 | { |
| 95 | case ConvolutionMethod::WINOGRAD: |
| 96 | { |
| 97 | ARM_COMPUTE_ERROR_ON(conv2d_info.num_groups != 1); |
| 98 | auto f = std::make_unique<ClWinogradConv2d>(); |
| 99 | f->configure(compile_context, src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info, |
| 100 | conv2d_info.enable_fast_math); |
| 101 | _operator = std::move(f); |
| 102 | break; |
| 103 | } |
| 104 | case ConvolutionMethod::DIRECT: |
| 105 | { |
| 106 | ARM_COMPUTE_ERROR_ON(conv2d_info.num_groups != 1); |
| 107 | auto f = std::make_unique<ClDirectConv2d>(); |
| 108 | f->configure(compile_context, src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info); |
| 109 | _operator = std::move(f); |
| 110 | break; |
| 111 | } |
| 112 | case ConvolutionMethod::INDIRECT: |
| 113 | { |
| 114 | ARM_COMPUTE_ERROR_ON(conv2d_info.num_groups != 1); |
| 115 | auto f = std::make_unique<ClIndirectConv2d>(); |
| 116 | f->configure(compile_context, src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info); |
| 117 | _operator = std::move(f); |
| 118 | break; |
| 119 | } |
| 120 | case ConvolutionMethod::GEMM: |
| 121 | { |
| 122 | auto f = std::make_unique<ClGemmConv2d>(); |
| 123 | f->configure(compile_context, src, weights, biases, dst, conv2d_info, weights_info); |
| 124 | _operator = std::move(f); |
| 125 | break; |
| 126 | } |
| 127 | default: |
| 128 | ARM_COMPUTE_ERROR("Not supported."); |
| 129 | break; |
| 130 | } |
| 131 | _aux_mem = _operator->workspace(); |
| 132 | } |
| 133 | |
| 134 | Status ClConv2d::validate(const ITensorInfo *src, |
| 135 | const ITensorInfo *weights, |