MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure

Method configure

src/gpu/cl/kernels/ClDirectConv2dKernel.cpp:187–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void ClDirectConv2dKernel::configure(const CLCompileContext &compile_context,
188 ITensorInfo *src,
189 ITensorInfo *weights,
190 ITensorInfo *biases,
191 ITensorInfo *dst,
192 const PadStrideInfo &conv_info,
193 const ActivationLayerInfo &act_info,
194 const DirectConvComputeKernelInfo &desc)
195{
196 ARM_COMPUTE_ERROR_ON_NULLPTR(src, weights, dst);
197
198 // Perform validation
199 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, weights, biases, dst, conv_info, act_info, desc));
200
201 const int conv_stride_x = std::get<0>(conv_info.stride());
202 const int conv_stride_y = std::get<1>(conv_info.stride());
203
204 _data_layout = src->data_layout();
205 _conv_info = conv_info;
206
207 const unsigned int width_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH);
208 const unsigned int height_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT);
209 const unsigned int channel_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::CHANNEL);
210 const unsigned int kernel_size = weights->dimension(width_idx);
211 const DataType data_type = src->data_type();
212
213 const GPUTarget gpu_target = get_target();
214 unsigned int _num_elems_processed_per_iteration = 0;
215
216 // Get dst shape
217 TensorShape output_shape = misc::shape_calculator::compute_deep_convolution_shape(*src, *weights, conv_info);
218
219 // Output auto inizialitation if not yet initialized
220 auto_init_if_empty(*dst, output_shape, 1, src->data_type(), src->quantization_info());
221
222 // Configure kernel window
223 Window win;
224 if (_data_layout == DataLayout::NHWC)
225 {
226 output_shape.collapse(2U, 1U);
227 const unsigned int n0 = adjust_vec_size(desc.n0, output_shape[0]);
228 const unsigned int m0 = adjust_vec_size(desc.m0, output_shape[1]);
229
230 // Create window and update padding
231 win = calculate_max_window(output_shape, Steps(n0, m0));
232 }
233 else if (_data_layout == DataLayout::NCHW)
234 {
235 _num_elems_processed_per_iteration = 1u;
236 win = calculate_max_window(*dst, Steps(_num_elems_processed_per_iteration));
237 }
238
239 ICLKernel::configure_internal(win);
240
241 std::stringstream kernel_name;
242 CLBuildOptions build_options;
243
244 if (_data_layout == DataLayout::NHWC)

Callers

nothing calls this directly

Calls 15

auto_init_if_emptyFunction · 0.85
adjust_vec_sizeFunction · 0.85
StepsClass · 0.85
lower_stringFunction · 0.85
is_data_type_quantizedFunction · 0.85
PixelValueClass · 0.85
create_kernelFunction · 0.85

Tested by

no test coverage detected