giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 1 | /* |
Viet-Hoa Do | 019a7d9 | 2023-06-27 16:33:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2021, 2023 Arm Limited. |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 3 | * |
| 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 | */ |
| 24 | #include "arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h" |
| 25 | |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 26 | #include "arm_compute/core/CL/CLKernelLibrary.h" |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/Helpers.h" |
| 28 | #include "arm_compute/core/Utils.h" |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 29 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 30 | #include "arm_compute/core/Validate.h" |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 31 | #include "arm_compute/runtime/CL/CLScheduler.h" |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 32 | |
| 33 | #include "src/common/utils/Log.h" |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 34 | #include "src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h" |
| 35 | #include "src/core/CL/kernels/CLFillBorderKernel.h" |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 36 | #include "src/core/helpers/AutoConfiguration.h" |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 37 | |
| 38 | #include <memory> |
| 39 | #include <tuple> |
| 40 | |
| 41 | namespace arm_compute |
| 42 | { |
| 43 | using namespace arm_compute::misc::shape_calculator; |
| 44 | |
| 45 | CLDirectDeconvolutionLayer::CLDirectDeconvolutionLayer(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT |
| 46 | : _memory_group(std::move(memory_manager)), |
| 47 | _scale_f(), |
| 48 | _conv_f(), |
| 49 | _flip_weights(), |
| 50 | _scaled_output(), |
| 51 | _original_weights(nullptr), |
| 52 | _weights_flipped(), |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 53 | _flip_axis(), |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 54 | _is_prepared(false) |
| 55 | { |
| 56 | } |
| 57 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 58 | Status CLDirectDeconvolutionLayer::validate(const ITensorInfo *input, |
| 59 | const ITensorInfo *weights, |
| 60 | const ITensorInfo *bias, |
| 61 | ITensorInfo *output, |
| 62 | const PadStrideInfo &info, |
| 63 | const WeightsInfo &weights_info) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 64 | { |
| 65 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, output); |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 66 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8_SIGNED, DataType::QASYMM8, |
| 67 | DataType::F16, DataType::F32); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 68 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(input, weights); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 69 | const DataLayout data_layout = input->data_layout(); |
| 70 | |
| 71 | const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); |
| 72 | const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); |
| 73 | const size_t idx_c = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); |
| 74 | |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 75 | ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_w) < 1); |
Viet-Hoa Do | 019a7d9 | 2023-06-27 16:33:57 +0100 | [diff] [blame] | 76 | ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_h) < 1); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 77 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 78 | auto out_dims = deconvolution_output_dimensions(input->dimension(idx_w), input->dimension(idx_h), |
| 79 | weights->dimension(idx_w), weights->dimension(idx_h), info); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 80 | |
| 81 | const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input, *weights); |
| 82 | |
Freddie Liardet | e92b045 | 2021-04-22 14:55:17 +0100 | [diff] [blame] | 83 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); |
| 84 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 85 | if (input->data_type() != weights->data_type()) |
Freddie Liardet | e92b045 | 2021-04-22 14:55:17 +0100 | [diff] [blame] | 86 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 87 | ARM_COMPUTE_RETURN_ERROR_ON(weights->data_type() != DataType::QSYMM8_PER_CHANNEL || |
| 88 | !is_data_type_quantized_asymmetric(input->data_type())); |
Freddie Liardet | e92b045 | 2021-04-22 14:55:17 +0100 | [diff] [blame] | 89 | } |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 90 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 91 | if (bias != nullptr) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 92 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 93 | if (is_data_type_quantized_asymmetric(input->data_type())) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 94 | { |
| 95 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(bias, 1, DataType::S32); |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, bias); |
| 100 | } |
| 101 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(input, bias); |
| 102 | } |
| 103 | |
| 104 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_w) != output_shape[idx_w], "Output's width is invalid."); |
| 105 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_h) != output_shape[idx_h], "Output's height is invalid."); |
| 106 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_c) != output_shape[idx_c], "Output's depth is invalid."); |
| 107 | |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 108 | unsigned int deconv_pad_x = 0; |
| 109 | unsigned int deconv_pad_y = 0; |
| 110 | const unsigned int stride_x = info.stride().first; |
| 111 | const unsigned int stride_y = info.stride().second; |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 112 | const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, |
| 113 | out_dims, deconv_pad_x, deconv_pad_y); |
| 114 | TensorInfo scale_out_info(input->clone() |
| 115 | ->set_is_resizable(true) |
| 116 | .reset_padding() |
| 117 | .set_tensor_shape(scale_out_shape) |
| 118 | .set_data_layout(data_layout)); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 119 | const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL); |
| 120 | |
Manuel Bottini | c1b76fa | 2019-06-17 12:04:40 +0100 | [diff] [blame] | 121 | ARM_COMPUTE_RETURN_ON_ERROR(CLDeconvolutionLayerUpsample::validate(input, &scale_out_info, info)); |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 122 | ARM_COMPUTE_RETURN_ON_ERROR( |
| 123 | CLConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, weights_info)); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 124 | |
| 125 | return Status{}; |
| 126 | } |
| 127 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 128 | void CLDirectDeconvolutionLayer::configure(ICLTensor *input, |
| 129 | ICLTensor *weights, |
| 130 | const ICLTensor *bias, |
| 131 | ICLTensor *output, |
| 132 | const PadStrideInfo &info, |
| 133 | const WeightsInfo &weights_info) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 134 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 135 | configure(CLKernelLibrary::get().get_compile_context(), input, weights, bias, output, info, weights_info); |
| 136 | } |
| 137 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 138 | void CLDirectDeconvolutionLayer::configure(const CLCompileContext &compile_context, |
| 139 | ICLTensor *input, |
| 140 | ICLTensor *weights, |
| 141 | const ICLTensor *bias, |
| 142 | ICLTensor *output, |
| 143 | const PadStrideInfo &info, |
| 144 | const WeightsInfo &weights_info) |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 145 | { |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 146 | ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output); |
ramelg01 | 6d89157 | 2021-09-29 10:05:09 +0100 | [diff] [blame] | 147 | ARM_COMPUTE_LOG_PARAMS(input, weights, bias, output, info, weights_info); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 148 | |
Matthew Jackson | b9070a4 | 2019-08-22 16:13:27 +0100 | [diff] [blame] | 149 | const unsigned int pad_left = info.pad_left(); |
| 150 | const unsigned int pad_right = info.pad_right(); |
| 151 | const unsigned int pad_top = info.pad_top(); |
| 152 | const unsigned int pad_bottom = info.pad_bottom(); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 153 | const unsigned int stride_x = info.stride().first; |
| 154 | const unsigned int stride_y = info.stride().second; |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 155 | |
| 156 | const DataLayout data_layout = input->info()->data_layout(); |
| 157 | |
| 158 | const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); |
| 159 | const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); |
| 160 | |
| 161 | _original_weights = weights; |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 162 | _flip_axis.allocator()->init(TensorInfo(TensorShape(2U), 1, DataType::U32)); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 163 | _weights_flipped.allocator()->init(weights->info()->clone()->set_data_layout(data_layout)); |
Adnan AlSinan | 704c22f | 2023-10-24 11:05:56 +0100 | [diff] [blame] | 164 | _flip_weights.configure(compile_context, weights, &_weights_flipped, &_flip_axis, /* use_inverted_axis */ false); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 165 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 166 | auto out_dims = |
| 167 | deconvolution_output_dimensions(input->info()->dimension(idx_w), input->info()->dimension(idx_h), |
| 168 | weights->info()->dimension(idx_w), weights->info()->dimension(idx_h), info); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 169 | |
| 170 | const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input->info(), *weights->info()); |
| 171 | |
| 172 | // Output auto initialization if not yet initialized |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 173 | auto_init_if_empty(*output->info(), |
| 174 | input->info()->clone()->set_tensor_shape(output_shape).set_data_layout(data_layout)); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 175 | |
| 176 | // Perform validation step |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 177 | ARM_COMPUTE_ERROR_THROW_ON(CLDirectDeconvolutionLayer::validate( |
| 178 | input->info(), weights->info(), bias == nullptr ? nullptr : bias->info(), output->info(), info)); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 179 | |
| 180 | _is_prepared = weights_info.retain_internal_weights(); |
| 181 | |
| 182 | _memory_group.manage(&_scaled_output); |
| 183 | |
| 184 | // Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape |
Matthew Jackson | b9070a4 | 2019-08-22 16:13:27 +0100 | [diff] [blame] | 185 | unsigned int deconv_pad_x = 0; |
| 186 | unsigned int deconv_pad_y = 0; |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 187 | const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape( |
| 188 | *input->info(), *weights->info(), stride_x, stride_y, out_dims, deconv_pad_x, deconv_pad_y); |
Matthew Jackson | b9070a4 | 2019-08-22 16:13:27 +0100 | [diff] [blame] | 189 | |
| 190 | unsigned int deconv_pad_left = pad_right > pad_left ? pad_right - pad_left : 0; |
| 191 | unsigned int deconv_pad_right = pad_left > pad_right ? pad_left - pad_right : 0; |
| 192 | deconv_pad_x -= deconv_pad_left + deconv_pad_right; |
| 193 | ARM_COMPUTE_ERROR_ON((deconv_pad_x % 2) != 0); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 194 | deconv_pad_left += deconv_pad_x / 2; |
Matthew Jackson | b9070a4 | 2019-08-22 16:13:27 +0100 | [diff] [blame] | 195 | deconv_pad_right += deconv_pad_x / 2; |
| 196 | |
| 197 | unsigned int deconv_pad_top = pad_bottom > pad_top ? pad_bottom - pad_top : 0; |
| 198 | unsigned int deconv_pad_bottom = pad_top > pad_bottom ? pad_top - pad_bottom : 0; |
| 199 | deconv_pad_y -= deconv_pad_top + deconv_pad_bottom; |
| 200 | ARM_COMPUTE_ERROR_ON((deconv_pad_y % 2) != 0); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 201 | deconv_pad_top += deconv_pad_y / 2; |
Matthew Jackson | b9070a4 | 2019-08-22 16:13:27 +0100 | [diff] [blame] | 202 | deconv_pad_bottom += deconv_pad_y / 2; |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 203 | |
| 204 | TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(), input->info()->quantization_info()); |
| 205 | scale_out_info.set_data_layout(data_layout); |
| 206 | _scaled_output.allocator()->init(scale_out_info); |
| 207 | |
| 208 | // configure scale function |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 209 | const PadStrideInfo upsample_info(stride_x, stride_y, deconv_pad_left, deconv_pad_right, deconv_pad_top, |
| 210 | deconv_pad_bottom, DimensionRoundingType::FLOOR); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 211 | _scale_f.configure(compile_context, input, &_scaled_output, upsample_info); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 212 | |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 213 | // Setup the function to convolve the upscaled output |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 214 | const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 215 | _conv_f.configure(compile_context, &_scaled_output, &_weights_flipped, bias, output, conv_info, weights_info); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 216 | _scaled_output.allocator()->allocate(); |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 217 | |
| 218 | // Setup flip axis data |
| 219 | _flip_axis.allocator()->allocate(); |
| 220 | _flip_axis.map(true); |
| 221 | auto axis_data = reinterpret_cast<uint32_t *>(_flip_axis.buffer()); |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 222 | if (weights->info()->data_layout() == DataLayout::NHWC) |
giuros01 | 46a49a0 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 223 | { |
| 224 | axis_data[0] = 1; |
| 225 | axis_data[1] = 2; |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | axis_data[0] = 0; |
| 230 | axis_data[1] = 1; |
| 231 | } |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 232 | _flip_axis.unmap(); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | void CLDirectDeconvolutionLayer::run() |
| 236 | { |
| 237 | prepare(); |
| 238 | |
Georgios Pinitas | da953f2 | 2019-04-02 17:27:03 +0100 | [diff] [blame] | 239 | MemoryGroupResourceScope scope_mg(_memory_group); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 240 | |
| 241 | _scale_f.run(); |
| 242 | _conv_f.run(); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | void CLDirectDeconvolutionLayer::prepare() |
| 246 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 247 | if (!_is_prepared) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 248 | { |
| 249 | ARM_COMPUTE_ERROR_ON(!_original_weights->is_used()); |
| 250 | |
| 251 | // Run weights flipping and mark original weights tensor as unused |
| 252 | _weights_flipped.allocator()->allocate(); |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 253 | _flip_weights.run(); |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 254 | _original_weights->mark_as_unused(); |
| 255 | |
| 256 | // Prepare convolution |
| 257 | _conv_f.prepare(); |
| 258 | |
Georgios Pinitas | dbfc2dc | 2019-04-02 12:51:21 +0100 | [diff] [blame] | 259 | // Free flipped weights |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 260 | if (!_weights_flipped.is_used()) |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 261 | { |
| 262 | _weights_flipped.allocator()->free(); |
| 263 | } |
giuros01 | 4a8ec80 | 2019-03-18 13:25:05 +0000 | [diff] [blame] | 264 | _is_prepared = true; |
| 265 | } |
| 266 | } |
| 267 | } // namespace arm_compute |