| 146 | } |
| 147 | |
| 148 | void NEDepthToSpaceLayerKernel::run(const Window &window, const ThreadInfo &info) |
| 149 | { |
| 150 | ARM_COMPUTE_UNUSED(info); |
| 151 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 152 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICPPKernel::window(), window); |
| 153 | |
| 154 | const auto *input_info = _input->info(); |
| 155 | const auto *output_info = _output->info(); |
| 156 | |
| 157 | const auto element_size = input_info->element_size(); |
| 158 | const auto &input_strides = input_info->strides_in_bytes(); |
| 159 | const auto &output_strides = output_info->strides_in_bytes(); |
| 160 | |
| 161 | const auto &input_shape = input_info->tensor_shape(); |
| 162 | |
| 163 | const uintptr_t k_input_strides[] = {input_strides[0], input_strides[1], input_strides[2], input_strides[3]}; |
| 164 | const uintptr_t k_output_strides[] = {output_strides[0], output_strides[1], output_strides[2], output_strides[3]}; |
| 165 | |
| 166 | const uint8_t *k_input_ptr = _input->buffer(); |
| 167 | uint8_t *k_output_ptr = // |
| 168 | _output->buffer() + // |
| 169 | window[3].start() * output_strides[3] + // |
| 170 | window[2].start() * output_strides[2] + // |
| 171 | window[1].start() * output_strides[1] + // |
| 172 | window[0].start() * output_strides[0]; |
| 173 | |
| 174 | if (_data_layout == DataLayout::NCHW) |
| 175 | { |
| 176 | ARM_COMPUTE_ERROR_ON_MSG(window[2].start() != 0 || window[2].end() != window[2].step(), |
| 177 | "The window cannot be splitted in channel dimension"); |
| 178 | |
| 179 | const uintptr_t k_input_shape[] = { |
| 180 | window.num_iterations(0), // |
| 181 | window.num_iterations(1), // |
| 182 | input_shape[2], // The window cannot be splitted in channel dimension. |
| 183 | window.num_iterations(3) // |
| 184 | }; |
| 185 | |
| 186 | k_input_ptr += window[3].start() * input_strides[3] + // |
| 187 | window[2].start() * _block_shape * _block_shape * input_strides[2] + // |
| 188 | (window[1].start() / _block_shape) * input_strides[1] + // |
| 189 | (window[0].start() / _block_shape) * input_strides[0]; |
| 190 | |
| 191 | cpu::depth_to_space_nchw_any( // |
| 192 | k_input_ptr, k_output_ptr, // |
| 193 | k_input_shape, k_input_strides, k_output_strides, // |
| 194 | element_size, _block_shape); |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | ARM_COMPUTE_ERROR_ON_MSG(window[0].start() != 0 || window[0].end() != window[0].step(), |
| 199 | "The window cannot be splitted in channel dimension"); |
| 200 | |
| 201 | const uintptr_t k_input_shape[] = { |
| 202 | input_shape[0], // The window cannot be splitted in channel dimension. |
| 203 | window.num_iterations(1), // |
| 204 | window.num_iterations(2), // |
| 205 | window.num_iterations(3) // |
nothing calls this directly
no test coverage detected