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

Method configure

src/cpu/operators/CpuPool2d.cpp:53–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51CpuPool2d::~CpuPool2d() = default;
52
53void CpuPool2d::configure(ITensorInfo *src, ITensorInfo *dst, const PoolingLayerInfo &pool_info, ITensorInfo *indices)
54{
55 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuPool2d::configure");
56 ARM_COMPUTE_LOG_PARAMS(src, dst, pool_info, indices);
57
58 // Check if we can run assembly kernels. Currently, indices are not supported by those kernels
59 const bool run_optimised =
60 bool(kernels::CpuPool2dAssemblyWrapperKernel::validate(src, dst, pool_info)) && (indices == nullptr);
61
62 // Get data layout
63 _data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? src->data_layout() : pool_info.data_layout;
64
65 // Check if we have Global Pooling Layer
66 const unsigned int idx_width = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH);
67 const unsigned int idx_height = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT);
68 _is_global_pooling_layer = (src->dimension(idx_width) == pool_info.pool_size.width) &&
69 (src->dimension(idx_height) == pool_info.pool_size.height);
70 _use_kernel_indices = pool_info.use_kernel_indices;
71
72 if (run_optimised)
73 {
74 const CPUInfo &ci = NEScheduler::get().cpu_info();
75 const unsigned int num_threads = NEScheduler::get().num_threads();
76
77 auto pooling_wrapper = std::make_unique<kernels::CpuPool2dAssemblyWrapperKernel>();
78 ARM_COMPUTE_ERROR_ON(pooling_wrapper == nullptr);
79 pooling_wrapper->configure(src, dst, pool_info, ci);
80
81 // Get kernel's memory requirements
82 constexpr size_t alignment = 4096;
83 const size_t workspace_size = pooling_wrapper->get_working_size(num_threads);
84 _aux_mem[0] = MemoryInfo(TensorType::ACL_INT_0, MemoryLifetime::Temporary, workspace_size, alignment);
85
86 _asm_glue = std::move(pooling_wrapper);
87 }
88 else
89 {
90 // Configure pooling kernel
91 auto k = std::make_unique<kernels::CpuPool2dKernel>();
92 k->configure(src, dst, pool_info, indices);
93 _pooling_layer_kernel = std::move(k);
94 }
95}
96
97Status CpuPool2d::validate(const ITensorInfo *src,
98 const ITensorInfo *dst,

Callers

nothing calls this directly

Calls 6

MemoryInfoClass · 0.85
validateFunction · 0.50
data_layoutMethod · 0.45
dimensionMethod · 0.45
num_threadsMethod · 0.45
get_working_sizeMethod · 0.45

Tested by

no test coverage detected