MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure

Method configure

src/cpu/kernels/CpuTransposeKernel.cpp:734–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732} // namespace
733
734void 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
767Status CpuTransposeKernel::validate(const ITensorInfo *src, const ITensorInfo *dst)
768{

Callers

nothing calls this directly

Calls 12

compute_transposed_shapeFunction · 0.85
auto_init_if_emptyFunction · 0.85
num_elems_processedFunction · 0.85
StepsClass · 0.85
ValidRegionClass · 0.85
validateFunction · 0.50
calculate_max_windowFunction · 0.50
cloneMethod · 0.45
element_sizeMethod · 0.45
set_num_dimensionsMethod · 0.45
num_dimensionsMethod · 0.45
set_valid_regionMethod · 0.45

Tested by

no test coverage detected