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

Method configure

src/cpu/kernels/CpuPool2dKernel.cpp:308–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306} // namespace
307
308void CpuPool2dKernel::configure(ITensorInfo *src,
309 ITensorInfo *dst,
310 const PoolingLayerInfo &pool_info,
311 ITensorInfo *indices)
312{
313 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuPool2dKernel::configure");
314 ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst);
315 const PadStrideInfo pad_stride_info = pool_info.pad_stride_info;
316 const bool is_global_pooling = pool_info.is_global_pooling;
317
318 // Get data layout
319 const auto data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? src->data_layout() : pool_info.data_layout;
320 const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
321 const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
322
323 // Update pool size in case of global pooling
324 const Size2D pool_size(is_global_pooling ? src->dimension(idx_width) : pool_info.pool_size.width,
325 is_global_pooling ? src->dimension(idx_height) : pool_info.pool_size.height);
326
327 // Perform validation step
328 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, dst, pool_info, indices, pool_size));
329
330 const auto *uk = CpuPool2dKernel::get_implementation(
331 PoolDataTypeISASelectorData{src->data_type(), src->data_layout(), (int)pad_stride_info.stride().first,
332 pool_size, CPUInfo::get().get_isa()});
333 ARM_COMPUTE_ERROR_ON(uk == nullptr);
334
335 // Set instance variables
336 _pool_info = pool_info;
337 _data_layout = src->data_layout();
338 _pool_size = pool_size;
339 _pool_stride_x = pad_stride_info.stride().first;
340 _run_method = uk->ukernel;
341 _name = std::string("CpuPool2dKernel").append("/").append(uk->name);
342
343 if (_data_layout == DataLayout::NHWC)
344 {
345 // Configure kernel window
346 Window win = calculate_max_window(*dst, Steps());
347 ICpuKernel::configure(win);
348 }
349 else
350 {
351 // Configure kernel window
352 auto win_config = validate_and_configure_window(
353 src, dst, indices, pool_info, _num_elems_processed_per_iteration, pool_size.x(), pool_size.y());
354 ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
355 ICpuKernel::configure(win_config.second);
356 }
357}
358
359Status CpuPool2dKernel::validate(const ITensorInfo *src,
360 const ITensorInfo *dst,

Callers

nothing calls this directly

Calls 13

StepsClass · 0.85
get_isaMethod · 0.80
appendMethod · 0.80
validate_argumentsFunction · 0.70
get_implementationFunction · 0.50
calculate_max_windowFunction · 0.50
data_layoutMethod · 0.45
dimensionMethod · 0.45
data_typeMethod · 0.45
strideMethod · 0.45
xMethod · 0.45

Tested by

no test coverage detected