blob: 2ee23c4262958be1e8b85e44422300d5cabd9dee [file] [log] [blame]
Giorgio Arena93a690e2017-08-01 16:09:33 +01001/*
Manuel Bottinica62c6f2021-03-23 11:50:34 +00002 * Copyright (c) 2017-2021 Arm Limited.
Giorgio Arena93a690e2017-08-01 16:09:33 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000024#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h"
Giorgio Arena93a690e2017-08-01 16:09:33 +010025
Gian Marco Iodice8155c022021-04-16 15:08:59 +010026#include "arm_compute/core/CL/CLHelpers.h"
Giorgio Arena93a690e2017-08-01 16:09:33 +010027#include "arm_compute/core/CL/ICLTensor.h"
Georgios Pinitas05045c12018-12-07 18:31:47 +000028#include "arm_compute/core/Helpers.h"
Giorgio Arena93a690e2017-08-01 16:09:33 +010029#include "arm_compute/core/PixelValue.h"
Gian Marco Iodice8155c022021-04-16 15:08:59 +010030#include "arm_compute/core/Utils.h"
Georgios Pinitas9be0c5a2018-02-19 12:46:29 +000031#include "arm_compute/core/utils/misc/ShapeCalculator.h"
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +000032#include "arm_compute/core/utils/quantization/AsymmHelpers.h"
Giorgio Arena93a690e2017-08-01 16:09:33 +010033#include "arm_compute/runtime/CL/CLScheduler.h"
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010034#include "src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.h"
Giorgio Arena93a690e2017-08-01 16:09:33 +010035
ramelg016d891572021-09-29 10:05:09 +010036#include "src/common/utils/Log.h"
37
giuros016d109962019-01-07 17:47:19 +000038namespace arm_compute
39{
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +000040using namespace arm_compute::misc;
Georgios Pinitas9be0c5a2018-02-19 12:46:29 +000041using namespace arm_compute::misc::shape_calculator;
Giorgio Arena93a690e2017-08-01 16:09:33 +010042
Manuel Bottini05069f02019-09-26 17:18:26 +010043namespace
44{
Gian Marco Iodice8155c022021-04-16 15:08:59 +010045bool export_weights_to_cl_image_heuristic(const ITensorInfo *weights, unsigned int depth_multiplier, GPUTarget gpu_target)
Manuel Bottini05069f02019-09-26 17:18:26 +010046{
Gian Marco Iodice8155c022021-04-16 15:08:59 +010047 if(!export_weights_to_cl_image(weights))
Gian Marco Iodice561c1762021-04-16 15:08:59 +010048 {
Gian Marco Iodice8155c022021-04-16 15:08:59 +010049 return false;
50 }
Gian Marco Iodicec63b7222021-06-30 08:39:44 +000051
Gian Marco Iodice8155c022021-04-16 15:08:59 +010052 const size_t idx_w = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::WIDTH);
53 const size_t idx_h = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::HEIGHT);
54 const size_t kernel_w = weights->tensor_shape()[idx_w];
55 const size_t kernel_h = weights->tensor_shape()[idx_h];
56
57 if((kernel_w == 1) && (kernel_h == 1))
58 {
59 return false;
60 }
61
62 if(depth_multiplier > 1)
63 {
64 return false;
65 }
66
67 if(gpu_target == GPUTarget::G71 || get_arch_from_target(gpu_target) == GPUTarget::MIDGARD)
68 {
69 return false;
70 }
71
72 return true;
73}
74
75void initialize_dwc_native_compute_info(DWCComputeKernelInfo &dwc_compute_info, const ITensorInfo *weights, const PadStrideInfo &conv_info, const Size2D &dilation, unsigned int depth_multiplier,
76 GPUTarget gpu_target)
77{
78 if(!is_data_type_float(weights->data_type()))
79 {
80 dwc_compute_info.export_weights_to_cl_image = false;
81 dwc_compute_info.n0 = (depth_multiplier == 1) ? 4 : 1;
82 if(conv_info.stride().first == 1 && dilation.x() == 1 && depth_multiplier == 1)
83 {
84 dwc_compute_info.m0 = 2;
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +010085 }
86 else
87 {
Gian Marco Iodice8155c022021-04-16 15:08:59 +010088 dwc_compute_info.m0 = 1;
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +010089 }
Gian Marco Iodice8155c022021-04-16 15:08:59 +010090
91 return;
Manuel Bottini05069f02019-09-26 17:18:26 +010092 }
93
Gian Marco Iodice8155c022021-04-16 15:08:59 +010094 // Floating point path
95
96 // First check if we can export to cl_image.
97 dwc_compute_info.export_weights_to_cl_image = export_weights_to_cl_image_heuristic(weights, depth_multiplier, gpu_target);
98
99 // Set n0
100 if(depth_multiplier == 1)
Manuel Bottini05069f02019-09-26 17:18:26 +0100101 {
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100102 if(dwc_compute_info.export_weights_to_cl_image == false && weights->data_type() == DataType::F16)
103 {
104 dwc_compute_info.n0 = 8;
105 }
106 else
107 {
108 dwc_compute_info.n0 = 4;
109 }
Manuel Bottini05069f02019-09-26 17:18:26 +0100110 }
111 else
112 {
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100113 dwc_compute_info.n0 = 1;
Manuel Bottini05069f02019-09-26 17:18:26 +0100114 }
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100115
116 dwc_compute_info.n0 = adjust_vec_size(dwc_compute_info.n0, weights->dimension(0));
117
118 // Set m0 only if stride_x == 1 and dilation_x == 1
119 if(conv_info.stride().first == 1 && dilation.x() == 1)
120 {
121 const size_t idx_w = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::WIDTH);
122 const size_t kernel_w = weights->tensor_shape()[idx_w];
123
124 dwc_compute_info.m0 = (kernel_w >= 9) || (kernel_w == 1) ? 1 : 2;
125 }
126 else
127 {
128 dwc_compute_info.m0 = 1;
129 }
130 return;
Manuel Bottini05069f02019-09-26 17:18:26 +0100131}
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100132
Manuel Bottini05069f02019-09-26 17:18:26 +0100133} // namespace
134
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100135CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayer(std::shared_ptr<IMemoryManager> memory_manager)
Manuel Bottini05069f02019-09-26 17:18:26 +0100136 : _memory_group(std::move(memory_manager)),
Georgios Pinitas40f51a62020-11-21 03:04:18 +0000137 _dwc_native_kernel(std::make_unique<CLDepthwiseConvolutionLayerNativeKernel>()),
Manuel Bottini05069f02019-09-26 17:18:26 +0100138 _permute_input_to_nhwc(),
139 _permute_weights_to_nhwc(),
140 _permute_output_to_nchw(),
141 _permuted_input(),
142 _permuted_weights(),
143 _permuted_output(),
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100144 _output_multipliers(),
145 _output_shifts(),
Manuel Bottini05069f02019-09-26 17:18:26 +0100146 _original_weights(),
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100147 _input(),
148 _output(),
Manuel Bottini05069f02019-09-26 17:18:26 +0100149 _needs_permute(false),
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100150 _is_prepared(false),
151 _is_quantized(false)
Manuel Bottini05069f02019-09-26 17:18:26 +0100152{
153}
154
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +0100155CLDepthwiseConvolutionLayer::~CLDepthwiseConvolutionLayer() = default;
156
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100157void CLDepthwiseConvolutionLayer::configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info,
158 unsigned int depth_multiplier, ActivationLayerInfo act_info, const Size2D &dilation)
Manuel Bottini05069f02019-09-26 17:18:26 +0100159{
Manuel Bottini2b84be52020-04-08 10:15:51 +0100160 configure(CLKernelLibrary::get().get_compile_context(), input, weights, biases, output, conv_info, depth_multiplier, act_info, dilation);
161}
162
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100163void CLDepthwiseConvolutionLayer::configure(const CLCompileContext &compile_context, ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases,
164 ICLTensor *output, const PadStrideInfo &conv_info,
165 unsigned int depth_multiplier, ActivationLayerInfo act_info, const Size2D &dilation)
Manuel Bottini2b84be52020-04-08 10:15:51 +0100166{
SiCongLibc4e3112021-06-29 13:18:30 +0100167 ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights);
Manuel Bottini05069f02019-09-26 17:18:26 +0100168 ARM_COMPUTE_ERROR_THROW_ON(CLDepthwiseConvolutionLayer::validate(input->info(),
169 weights->info(),
170 biases != nullptr ? biases->info() : nullptr,
SiCongLibc4e3112021-06-29 13:18:30 +0100171 output != nullptr ? output->info() : input->info(),
Manuel Bottini05069f02019-09-26 17:18:26 +0100172 conv_info,
173 depth_multiplier,
174 act_info,
175 dilation));
ramelg016d891572021-09-29 10:05:09 +0100176 ARM_COMPUTE_LOG_PARAMS(input, weights, biases, output, conv_info, depth_multiplier, act_info, dilation);
Manuel Bottini05069f02019-09-26 17:18:26 +0100177
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100178 _is_quantized = is_data_type_quantized(input->info()->data_type());
Manuel Bottini05069f02019-09-26 17:18:26 +0100179 _is_prepared = false;
180 _original_weights = weights;
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100181 _input = input;
182 _output = output;
Manuel Bottini05069f02019-09-26 17:18:26 +0100183 _needs_permute = input->info()->data_layout() == DataLayout::NCHW;
184
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100185 const GPUTarget gpu_target = CLScheduler::get().target();
186
Manuel Bottini05069f02019-09-26 17:18:26 +0100187 ICLTensor *input_to_use = input;
188 const ICLTensor *weights_to_use = weights;
189 ICLTensor *output_to_use = output;
190 if(_needs_permute)
191 {
192 _memory_group.manage(&_permuted_input);
193 _memory_group.manage(&_permuted_output);
194
195 // Configure the function to transform the input tensor from NCHW -> NHWC
Manuel Bottini2b84be52020-04-08 10:15:51 +0100196 _permute_input_to_nhwc.configure(compile_context, input, &_permuted_input, PermutationVector(2U, 0U, 1U));
Manuel Bottini05069f02019-09-26 17:18:26 +0100197 _permuted_input.info()->set_data_layout(DataLayout::NHWC);
198
199 // Configure the function to transform the weights tensor from IHW -> HWI
Manuel Bottini2b84be52020-04-08 10:15:51 +0100200 _permute_weights_to_nhwc.configure(compile_context, weights, &_permuted_weights, PermutationVector(2U, 0U, 1U));
Manuel Bottini05069f02019-09-26 17:18:26 +0100201 _permuted_weights.info()->set_data_layout(DataLayout::NHWC);
202
203 // Set output quantization info before dwc kernel configure
204 _permuted_output.info()->set_quantization_info(output->info()->quantization_info());
205
206 input_to_use = &_permuted_input;
207 weights_to_use = &_permuted_weights;
208 output_to_use = &_permuted_output;
209 }
210
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100211 CLTensor *output_multipliers_to_use = nullptr;
212 CLTensor *output_shifts_to_use = nullptr;
213 if(_is_quantized)
214 {
215 const size_t idx_c = get_data_layout_dimension_index(weights->info()->data_layout(), DataLayoutDimension::CHANNEL);
216 const size_t num_filters = (is_data_type_quantized_per_channel(weights->info()->data_type())) ? weights->info()->dimension(idx_c) : 1;
217
218 _output_multipliers.allocator()->init(TensorInfo(TensorShape(num_filters), 1, DataType::S32));
219 _output_shifts.allocator()->init(TensorInfo(TensorShape(num_filters), 1, DataType::S32));
220
221 output_multipliers_to_use = &_output_multipliers;
222 output_shifts_to_use = &_output_shifts;
223 }
224
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100225 DWCComputeKernelInfo dwc_native_compute_info;
226 initialize_dwc_native_compute_info(dwc_native_compute_info, weights_to_use->info(), conv_info, dilation, depth_multiplier, gpu_target);
227
228 const ConvolutionInfo conv_kernel_info{ conv_info, depth_multiplier, act_info, dilation };
229
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +0100230 _dwc_native_kernel->configure(compile_context, input_to_use, weights_to_use, biases, output_to_use,
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100231 dwc_native_compute_info, conv_kernel_info, output_multipliers_to_use, output_shifts_to_use);
Manuel Bottini05069f02019-09-26 17:18:26 +0100232
233 if(_needs_permute)
234 {
235 _permuted_input.allocator()->allocate();
236
237 // Configure the function to transform the convoluted output to NCHW format
238 _permuted_output.info()->set_data_layout(DataLayout::NCHW);
Manuel Bottini2b84be52020-04-08 10:15:51 +0100239 _permute_output_to_nchw.configure(compile_context, &_permuted_output, output, PermutationVector(1U, 2U, 0U));
Manuel Bottini05069f02019-09-26 17:18:26 +0100240 _permuted_output.allocator()->allocate();
241 }
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100242
243 if(_is_quantized)
244 {
245 _output_multipliers.allocator()->allocate();
246 _output_shifts.allocator()->allocate();
247 }
Manuel Bottini05069f02019-09-26 17:18:26 +0100248}
249
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100250Status CLDepthwiseConvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output,
251 const PadStrideInfo &conv_info,
252 unsigned int depth_multiplier, ActivationLayerInfo act_info, const Size2D &dilation)
Manuel Bottini05069f02019-09-26 17:18:26 +0100253{
SiCongLibc4e3112021-06-29 13:18:30 +0100254 const bool in_place = input == output || output == nullptr;
255 if(in_place)
256 {
257 output = input;
258 }
Manuel Bottini05069f02019-09-26 17:18:26 +0100259 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(input, output);
260 const size_t idx_w = get_data_layout_dimension_index(input->data_layout(), DataLayoutDimension::WIDTH);
261 const size_t idx_h = get_data_layout_dimension_index(input->data_layout(), DataLayoutDimension::HEIGHT);
262
263 ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_w) + (weights->dimension(idx_w) - 1) * (dilation.x() - 1) > input->dimension(idx_w) + conv_info.pad_left() + conv_info.pad_right());
264 ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_h) + (weights->dimension(idx_h) - 1) * (dilation.y() - 1) > input->dimension(idx_h) + conv_info.pad_top() + conv_info.pad_bottom());
265
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100266 const GPUTarget gpu_target = CLScheduler::get().target();
267
268 const ConvolutionInfo conv_kernel_info{ conv_info, depth_multiplier, act_info, dilation };
Manuel Bottini05069f02019-09-26 17:18:26 +0100269
270 const bool needs_permute = input->data_layout() == DataLayout::NCHW;
271
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100272 const bool is_quantized = is_data_type_quantized(input->data_type());
273
274 TensorInfo output_multipliers_shifts_info(TensorInfo(TensorShape(1U), 1, DataType::S32));
275 if(is_quantized)
276 {
277 if(is_data_type_quantized_per_channel(weights->data_type()))
278 {
279 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(weights, 1, DataType::QSYMM8_PER_CHANNEL);
280
281 const size_t idx_c = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::CHANNEL);
282 output_multipliers_shifts_info.set_tensor_shape(TensorShape(weights->dimension(idx_c)));
283 }
284 else
285 {
286 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, weights);
287 }
288 }
289
Manuel Bottini05069f02019-09-26 17:18:26 +0100290 if(needs_permute)
291 {
SiCongLibc4e3112021-06-29 13:18:30 +0100292 ARM_COMPUTE_RETURN_ERROR_ON_MSG(in_place, "In-place is supported only with NHWC data layout");
Michalis Spyrou60c3b0e2021-04-08 12:02:58 +0100293 TensorShape permuted_input_shape = input->tensor_shape();
294 TensorShape permuted_weights_shape = weights->tensor_shape();
295 const ConvolutionInfo info{ conv_info, depth_multiplier, ActivationLayerInfo(), dilation };
296 TensorShape permuted_output_shape = shape_calculator::compute_depthwise_convolution_shape(*input, *weights, info);
Manuel Bottini05069f02019-09-26 17:18:26 +0100297
298 permute(permuted_input_shape, PermutationVector(2U, 0U, 1U));
299 permute(permuted_weights_shape, PermutationVector(2U, 0U, 1U));
300 permute(permuted_output_shape, PermutationVector(2U, 0U, 1U));
301
302 const TensorInfo permuted_input = input->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(permuted_input_shape).set_data_layout(DataLayout::NHWC);
303 const TensorInfo permuted_weights = weights->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(permuted_weights_shape).set_data_layout(DataLayout::NHWC);
304 const TensorInfo permuted_output = output->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(permuted_output_shape).set_data_layout(DataLayout::NHWC);
305
306 ARM_COMPUTE_RETURN_ON_ERROR(CLPermute::validate(input, &permuted_input, PermutationVector(2U, 0U, 1U)));
307 ARM_COMPUTE_RETURN_ON_ERROR(CLPermute::validate(weights, &permuted_weights, PermutationVector(2U, 0U, 1U)));
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100308
309 DWCComputeKernelInfo dwc_native_compute_info;
310 initialize_dwc_native_compute_info(dwc_native_compute_info, &permuted_weights, conv_info, dilation, depth_multiplier, gpu_target);
311
312 ARM_COMPUTE_RETURN_ON_ERROR(CLDepthwiseConvolutionLayerNativeKernel::validate(&permuted_input, &permuted_weights, biases, &permuted_output,
313 dwc_native_compute_info, conv_kernel_info, &output_multipliers_shifts_info, &output_multipliers_shifts_info));
Manuel Bottini05069f02019-09-26 17:18:26 +0100314 ARM_COMPUTE_RETURN_ON_ERROR(CLPermute::validate(&permuted_output, output, PermutationVector(1U, 2U, 0U)));
315 }
316 else
317 {
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100318 DWCComputeKernelInfo dwc_native_compute_info;
319 initialize_dwc_native_compute_info(dwc_native_compute_info, weights, conv_info, dilation, depth_multiplier, gpu_target);
320 ARM_COMPUTE_RETURN_ON_ERROR(CLDepthwiseConvolutionLayerNativeKernel::validate(input, weights, biases, output, dwc_native_compute_info, conv_kernel_info, &output_multipliers_shifts_info,
321 &output_multipliers_shifts_info));
Manuel Bottini05069f02019-09-26 17:18:26 +0100322 }
323 return Status{};
324}
325
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100326void CLDepthwiseConvolutionLayer::run()
Manuel Bottini05069f02019-09-26 17:18:26 +0100327{
328 prepare();
329
330 MemoryGroupResourceScope scope_mg(_memory_group);
331
332 if(_needs_permute)
333 {
334 _permute_input_to_nhwc.run();
335 }
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +0100336 CLScheduler::get().enqueue(*_dwc_native_kernel);
Manuel Bottini05069f02019-09-26 17:18:26 +0100337 if(_needs_permute)
338 {
339 _permute_output_to_nchw.run();
340 }
341}
342
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100343void CLDepthwiseConvolutionLayer::prepare()
Manuel Bottini05069f02019-09-26 17:18:26 +0100344{
345 if(!_is_prepared)
346 {
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100347 if(_is_quantized)
348 {
349 _output_multipliers.map();
350 _output_shifts.map();
Vidhya Sudhan Loganathan951b8a42019-11-04 14:42:08 +0000351 quantization::compute_quantized_multipliers_and_shifts(_input->info(),
352 _original_weights->info(),
SiCongLibc4e3112021-06-29 13:18:30 +0100353 _output != nullptr ? _output->info() : _input->info(),
Michele Di Giorgiodf4cf572019-10-09 15:32:39 +0100354 reinterpret_cast<int32_t *>(_output_multipliers.ptr_to_element(Coordinates(0))),
355 reinterpret_cast<int32_t *>(_output_shifts.ptr_to_element(Coordinates(0))));
356 _output_multipliers.unmap();
357 _output_shifts.unmap();
358 }
359
Manuel Bottini05069f02019-09-26 17:18:26 +0100360 if(_needs_permute)
361 {
362 ARM_COMPUTE_ERROR_ON(!_original_weights->is_used());
363
364 _permuted_weights.allocator()->allocate();
365 _permute_weights_to_nhwc.run();
366 _original_weights->mark_as_unused();
367 }
368 _is_prepared = true;
369 }
370}
giuros016d109962019-01-07 17:47:19 +0000371} // namespace arm_compute