| 115 | } // namespace |
| 116 | |
| 117 | void ClTransposedConvolutionKernel::configure(const CLCompileContext &compile_context, |
| 118 | const ITensorInfo *input, |
| 119 | const ITensorInfo *weights, |
| 120 | const ITensorInfo *biases, |
| 121 | ITensorInfo *output, |
| 122 | const PadStrideInfo &deconv_info) |
| 123 | { |
| 124 | ARM_COMPUTE_UNUSED(biases, deconv_info); |
| 125 | ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output); |
| 126 | |
| 127 | // Perform validation |
| 128 | ARM_COMPUTE_ERROR_THROW_ON(validate(input, weights, biases, output, deconv_info)); |
| 129 | |
| 130 | constexpr unsigned int channel_idx = 0; |
| 131 | constexpr unsigned int width_idx = 1; |
| 132 | constexpr unsigned int height_idx = 2; |
| 133 | |
| 134 | const size_t input_channels = input->dimension(channel_idx); // same as weight channels |
| 135 | const size_t input_width = input->dimension(width_idx); |
| 136 | const size_t input_height = input->dimension(height_idx); |
| 137 | const size_t weights_width = weights->dimension(width_idx); |
| 138 | const size_t weights_height = weights->dimension(height_idx); |
| 139 | const size_t output_width = output->dimension(width_idx); |
| 140 | const size_t output_height = output->dimension(height_idx); |
| 141 | const size_t output_channels = output->dimension(channel_idx); |
| 142 | |
| 143 | // Calculate output shape |
| 144 | auto out_dims = |
| 145 | deconvolution_output_dimensions(input_width, input_height, weights_width, weights_height, deconv_info); |
| 146 | TensorShape output_shape = misc::shape_calculator::compute_deconvolution_output_shape(out_dims, *input, *weights); |
| 147 | auto_init_if_empty(*output, output_shape, 1, input->data_type(), input->quantization_info()); |
| 148 | |
| 149 | // Calculate updated paddings |
| 150 | // p' = k - p - 1 (k: kernel dimensions) |
| 151 | const uint32_t pad_left = weights_width - deconv_info.pad_left() - 1; |
| 152 | const uint32_t pad_top = weights_height - deconv_info.pad_top() - 1; |
| 153 | |
| 154 | // Configure kernel window |
| 155 | Window win; |
| 156 | output_shape.collapse(2U, 1U); // Collapse width and height into single dimension |
| 157 | |
| 158 | const unsigned int n0 = adjust_vec_size(16 / output->element_size(), output_channels); |
| 159 | const unsigned int m0 = 1; |
| 160 | const unsigned int k0 = adjust_vec_size(16 / input->element_size(), input_channels); |
| 161 | const unsigned int partial_store_n0 = output_channels % n0; |
| 162 | |
| 163 | // Create window and update padding |
| 164 | win = calculate_max_window(output_shape, Steps(n0, m0)); |
| 165 | ICLKernel::configure_internal(win); |
| 166 | |
| 167 | const std::string kernel_name = "transposed_convolution_nhwc"; |
| 168 | CLBuildOptions build_options; |
| 169 | |
| 170 | const DataType input_data_type = input->data_type(); |
| 171 | const PaddingInfo strides = deconv_info.stride(); |
| 172 | |
| 173 | if (biases != nullptr) |
| 174 | { |
nothing calls this directly
no test coverage detected