| 732 | } // namespace |
| 733 | |
| 734 | void CpuTransposeKernel::configure(const ITensorInfo *src, ITensorInfo *dst) |
| 735 | { |
| 736 | ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuTransposeKernel::configure"); |
| 737 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); |
| 738 | |
| 739 | // Destination auto inizialitation if not yet initialized |
| 740 | const TensorShape dst_shape = misc::shape_calculator::compute_transposed_shape(*src); |
| 741 | auto_init_if_empty(*dst, src->clone()->set_tensor_shape(dst_shape)); |
| 742 | |
| 743 | // Explicitly set the tensor shape to preserve dimensions |
| 744 | dst->set_tensor_shape(dst_shape); |
| 745 | |
| 746 | // Perform validation step |
| 747 | ARM_COMPUTE_ERROR_THROW_ON(validate(src, dst)); |
| 748 | |
| 749 | // Note: This kernel performs 16 elements per iteration. |
| 750 | // However, since we use a left-over for loop on both dimensions (X and Y), we cannot have any read or write out of memory |
| 751 | // For this reason num_elems_processed_per_iteration_x is set to 1 |
| 752 | const unsigned int num_elems_processed_per_iteration_x = 1; |
| 753 | const unsigned int num_elems_processed_per_iteration_y = num_elems_processed(src->element_size()); |
| 754 | |
| 755 | // Configure kernel window |
| 756 | Window win = |
| 757 | calculate_max_window(*src, Steps(num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y)); |
| 758 | |
| 759 | // The CpuTranspose doesn't need padding so update_window_and_padding() can be skipped |
| 760 | Coordinates coord; |
| 761 | coord.set_num_dimensions(dst->num_dimensions()); |
| 762 | dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); |
| 763 | |
| 764 | ICpuKernel::configure(win); |
| 765 | } |
| 766 | |
| 767 | Status CpuTransposeKernel::validate(const ITensorInfo *src, const ITensorInfo *dst) |
| 768 | { |
nothing calls this directly
no test coverage detected