24.02
|
Go to the documentation of this file.
41 : _memory_group(std::move(memory_manager)),
42 _digit_reverse_kernel(),
45 _digit_reversed_input(),
46 _digit_reverse_indices(),
61 const unsigned int N =
input->info()->tensor_shape()[config.
axis];
72 digit_reverse_config.
axis = config.
axis;
75 _digit_reverse_indices.
allocator()->
init(digit_reverse_indices_info);
76 _memory_group.
manage(&_digit_reversed_input);
77 _digit_reverse_kernel = std::make_unique<NEFFTDigitReverseKernel>();
78 _digit_reverse_kernel->configure(
input, &_digit_reversed_input, &_digit_reverse_indices, digit_reverse_config);
82 _num_ffts = decomposed_vector.size();
83 _fft_kernels.resize(_num_ffts);
86 for (
unsigned int i = 0; i < _num_ffts; ++i)
88 const unsigned int radix_for_stage = decomposed_vector.at(i);
92 fft_kernel_info.
radix = radix_for_stage;
93 fft_kernel_info.
Nx = Nx;
95 _fft_kernels[i] = std::make_unique<NEFFTRadixStageKernel>();
96 _fft_kernels[i]->configure(&_digit_reversed_input, ((i == (_num_ffts - 1)) && !is_c2r) ? output :
nullptr,
99 Nx *= radix_for_stage;
106 scale_config.
scale =
static_cast<float>(
N);
108 _scale_kernel = std::make_unique<NEFFTScaleKernel>();
109 is_c2r ? _scale_kernel->configure(&_digit_reversed_input, output, scale_config)
110 : _scale_kernel->configure(output,
nullptr, scale_config);
119 std::copy_n(digit_reverse_cpu.data(),
N,
reinterpret_cast<unsigned int *
>(_digit_reverse_indices.
buffer()));
131 const unsigned int N =
input->tensor_shape()[config.
axis];
136 if ((output !=
nullptr) && (output->
total_size() != 0))
154 for (
unsigned int i = 0; i < _num_ffts; ++i)
float scale
Axis to perform the kernel on.
virtual size_t num_channels() const =0
The number of channels for each tensor element.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
void init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
Shares the same backing memory with another tensor allocator, while the tensor info might be differen...
void configure(const ITensor *input, ITensor *output, const FFT1DInfo &config)
Initialise the function's source and destinations.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
unsigned int Nx
Nx coefficient.
Descriptor for FFT digit reverse kernels.
Interface for CPU tensor.
unsigned int radix
Radix to use.
Descriptor used by the FFT core kernels.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
~NEFFT1D()
Default destructor.
bool is_first_stage
Flags if the FFT kernels is the first stage of a decomposed FFT.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
std::vector< unsigned int > decompose_stages(unsigned int N, const std::set< unsigned int > &supported_factors)
Decompose a given 1D input size using the provided supported factors.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
unsigned int axis
Axis to perform the kernel on.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
@ U32
unsigned 32-bit number
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Descriptor for FFT scale kernels.
static IScheduler & get()
Access the scheduler singleton.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory.
unsigned int axis
Axis to run the FFT on.
Descriptor used by the FFT1D function.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
unsigned int axis
Axis to run the kernel on.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
Store the tensor's metadata.
FFTDirection direction
Direction of the FFT.
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
Memory group resources scope handling class.
Copyright (c) 2017-2024 Arm Limited.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
static std::set< unsigned int > supported_radix()
Returns the radix that are support by the FFT kernel.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
bool conjugate
Flag to conjugate the output/.
Store the tensor's metadata.
bool conjugate
Flag to conjugate the output/.
NEFFT1D(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default Constructor.
@ F32
32-bit floating-point number
void run() override
Run the kernels contained in the function.
std::vector< unsigned int > digit_reverse_indices(unsigned int N, const std::vector< unsigned int > &fft_stages)
Calculate digit reverse index vector given fft size and the decomposed stages.
#define ARM_COMPUTE_LOG_PARAMS(...)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const FFT1DInfo &config)
Static function to check if given info will lead to a valid configuration of NEFFT1D.