| 190 | } |
| 191 | |
| 192 | void NEStackLayerKernel::prepare() |
| 193 | { |
| 194 | // Prepare calculates the window at runtime, in case there is padding being added after configure() |
| 195 | const ITensorInfo *input_info = _input[0]->info(); |
| 196 | const int32_t num_dims = input_info->num_dimensions(); |
| 197 | const int32_t num_tensors = _input.size(); |
| 198 | |
| 199 | // Check if there are any paddings in the input tensors |
| 200 | bool has_padding = false; |
| 201 | for (const ITensor *in : _input) |
| 202 | { |
| 203 | if (has_holes(*in->info(), num_dims - 1)) |
| 204 | { |
| 205 | has_padding = true; |
| 206 | break; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | has_padding = has_padding || has_holes(*_output->info(), num_dims); |
| 211 | |
| 212 | Window win; |
| 213 | if (!has_padding) |
| 214 | { |
| 215 | _stack_fn = memcpy_stack; |
| 216 | |
| 217 | // 2D execution window (X,Y): [Num_tensors, Dimensions >= axis] |
| 218 | win.set(Window::DimX, Window::Dimension(0, num_tensors, 1)); |
| 219 | win.set(Window::DimY, Window::Dimension(0, input_info->tensor_shape().total_size_upper(_axis), 1)); |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | _stack_fn = elementwise_stack; |
| 224 | win = calculate_max_window(*input_info); |
| 225 | } |
| 226 | |
| 227 | INEKernel::configure(win); |
| 228 | } |
| 229 | |
| 230 | void NEStackLayerKernel::run(const Window &window, const ThreadInfo &info) |
| 231 | { |
nothing calls this directly
no test coverage detected