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

Method configure

src/runtime/NEON/functions/NEFFTConvolutionLayer.cpp:107–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105NEFFTConvolutionLayer::~NEFFTConvolutionLayer() = default;
106
107void NEFFTConvolutionLayer::configure(ITensor *input,
108 const ITensor *weights,
109 const ITensor *biases,
110 ITensor *output,
111 const PadStrideInfo &conv_info,
112 const ActivationLayerInfo &act_info,
113 bool enable_fast_math)
114{
115 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "NEFFTConvolutionLayer::configure");
116 ARM_COMPUTE_UNUSED(enable_fast_math);
117 ARM_COMPUTE_LOG_PARAMS(input, weights, biases, output, conv_info, act_info, enable_fast_math);
118
119 _original_weights = weights;
120 _original_bias = biases;
121
122 // Flat if bias addition is required
123 _has_bias = biases != nullptr;
124
125 // Get indices for the width and height
126 const size_t idx_width = get_data_layout_dimension_index(input->info()->data_layout(), DataLayoutDimension::WIDTH);
127 const size_t idx_height =
128 get_data_layout_dimension_index(input->info()->data_layout(), DataLayoutDimension::HEIGHT);
129
130 // Input shape, kernel size and output tile
131 const Size2D input_dims =
132 Size2D(input->info()->tensor_shape()[idx_width], input->info()->tensor_shape()[idx_height]);
133 const Size2D kernel_size =
134 Size2D(weights->info()->tensor_shape()[idx_width], weights->info()->tensor_shape()[idx_height]);
135 const Size2D pad_valid = Size2D(pad_decomposable(input_dims.x() + kernel_size.x() - 1),
136 pad_decomposable(input_dims.y() + kernel_size.y() - 1));
137 // Tensors to use
138 ITensor *input_to_use = input;
139 const ITensor *weights_to_use = weights;
140 ITensor *output_to_use = _has_bias ? &_bias_output : output;
141
142 // Permute bias
143 if (biases != nullptr)
144 {
145 _permute_bias_func.configure(biases, &_permuted_bias, PermutationVector(1U, 2U, 0U));
146 _permuted_bias.info()->set_data_layout(DataLayout::NCHW);
147 }
148
149 // Permute input if needed
150 _needs_permute = input->info()->data_layout() == DataLayout::NHWC;
151 if (_needs_permute)
152 {
153 _memory_group.manage(&_permuted_input);
154 // Configure the function to transform the input tensor from NHWC -> NCHW
155 _permute_input_func.configure(input, &_permuted_input, PermutationVector(1U, 2U, 0U));
156 _permuted_input.info()->set_data_layout(DataLayout::NCHW);
157
158 // Configure the function to transform the weights tensor from HWI -> IHW
159 _permute_weights_func.configure(weights, &_permuted_weights, PermutationVector(1U, 2U, 0U));
160 _permuted_weights.info()->set_data_layout(DataLayout::NCHW);
161
162 input_to_use = &_permuted_input;
163 weights_to_use = &_permuted_weights;
164 }

Callers

nothing calls this directly

Calls 15

Size2DClass · 0.85
FFT2DInfoClass · 0.85
auto_init_if_emptyFunction · 0.85
remove_dimensionMethod · 0.80
pad_leftMethod · 0.80
pad_topMethod · 0.80
pad_rightMethod · 0.80
pad_bottomMethod · 0.80
enabledMethod · 0.80
pad_decomposableFunction · 0.70
TensorInfoClass · 0.50
TensorShapeClass · 0.50

Tested by

no test coverage detected