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

Method configure

src/runtime/NEON/functions/NEConvolutionLayer.cpp:65–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63NEConvolutionLayer::~NEConvolutionLayer() = default;
64
65void NEConvolutionLayer::configure(ITensor *input,
66 const ITensor *weights,
67 const ITensor *biases,
68 ITensor *output,
69 const PadStrideInfo &conv_info,
70 const WeightsInfo &weights_info,
71 const Size2D &dilation,
72 const ActivationLayerInfo &act_info,
73 bool enable_fast_math,
74 unsigned int num_groups)
75{
76 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "NEConvolutionLayer::configure");
77 // Perform validate step
78 ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
79 ARM_COMPUTE_UNUSED(num_groups);
80 ARM_COMPUTE_ERROR_THROW_ON(NEConvolutionLayer::validate(
81 input->info(), weights->info(), ((biases != nullptr) ? biases->info() : nullptr), output->info(), conv_info,
82 weights_info, dilation, act_info, enable_fast_math, num_groups));
83 ARM_COMPUTE_LOG_PARAMS(input, weights, biases, output, conv_info, weights_info, dilation, act_info,
84 enable_fast_math, num_groups);
85
86 const Conv2dInfo info(conv_info, dilation, act_info, enable_fast_math, num_groups);
87 switch (cpu::CpuConv2d::get_convolution_method(input->info(), weights->info(), output->info(), conv_info,
88 weights_info, dilation, act_info, enable_fast_math))
89 {
90 case ConvolutionMethod::WINOGRAD:
91 case ConvolutionMethod::GEMM:
92 case ConvolutionMethod::GEMM_CONV2D:
93 case ConvolutionMethod::DIRECT:
94 {
95 auto f = std::make_unique<cpu::CpuConv2d>();
96 f->configure(input->info(), weights->info(), ((biases != nullptr) ? biases->info() : nullptr),
97 output->info(), conv_info, weights_info, dilation, act_info, enable_fast_math, num_groups);
98 _impl->op = std::move(f);
99 break;
100 }
101 case ConvolutionMethod::FFT:
102 {
103 auto f = std::make_unique<NEFFTConvolutionLayer>(_impl->memory_manager);
104 f->configure(input, weights, biases, output, conv_info, act_info);
105 _impl->func = std::move(f);
106 break;
107 }
108 default:
109 ARM_COMPUTE_ERROR("Not supported.");
110 break;
111 }
112
113 if (_impl->op)
114 {
115 _impl->memory_group = MemoryGroup(std::move(_impl->memory_manager));
116 _impl->aux_mem_req = _impl->op->workspace();
117 _impl->run_pack = {{ACL_SRC_0, input}, {ACL_SRC_1, weights}, {ACL_SRC_2, biases}, {ACL_DST, output}};
118 _impl->prep_pack = {{ACL_SRC_1, weights}, {ACL_SRC_2, biases}};
119 _impl->workspace = manage_workspace<Tensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack,
120 _impl->prep_pack, /* allocate_now */ false);
121 }
122 _impl->is_prepared = false;

Callers

nothing calls this directly

Calls 4

MemoryGroupClass · 0.85
validateFunction · 0.50
infoMethod · 0.45
workspaceMethod · 0.45

Tested by

no test coverage detected