Compute Library
 21.02
NEFFT2D Class Reference

Basic function to execute two dimensional FFT. More...

#include <NEFFT2D.h>

Collaboration diagram for NEFFT2D:
[legend]

Public Member Functions

 NEFFT2D (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Default Constructor. More...
 
 NEFFT2D (const NEFFT2D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEFFT2Doperator= (const NEFFT2D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEFFT2D (NEFFT2D &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NEFFT2Doperator= (NEFFT2D &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEFFT2D ()
 Default destructor. More...
 
void configure (const ITensor *input, ITensor *output, const FFT2DInfo &config)
 Initialise the function's source and destinations. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, const FFT2DInfo &config)
 Static function to check if given info will lead to a valid configuration of NEFFT2D. More...
 

Detailed Description

Basic function to execute two dimensional FFT.

This function calls the following Neon kernels:

  1. NEFFT1D 1D FFT is performed on the first given axis
  2. NEFFT1D 1D FFT is performed on the second given axis

Definition at line 44 of file NEFFT2D.h.

Constructor & Destructor Documentation

◆ NEFFT2D() [1/3]

NEFFT2D ( std::shared_ptr< IMemoryManager memory_manager = nullptr)

Default Constructor.

Definition at line 37 of file NEFFT2D.cpp.

38  : _memory_group(memory_manager), _first_pass_func(memory_manager), _second_pass_func(memory_manager), _first_pass_tensor()
39 {
40 }

◆ NEFFT2D() [2/3]

NEFFT2D ( const NEFFT2D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEFFT2D() [3/3]

NEFFT2D ( NEFFT2D &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ ~NEFFT2D()

~NEFFT2D ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
const FFT2DInfo config 
)

Initialise the function's source and destinations.

Parameters
[in]inputSource tensor. Data types supported: F32.
[out]outputDestination tensor. Data types and data layouts supported: Same as input.
[in]configFFT related configuration

Definition at line 42 of file NEFFT2D.cpp.

References TensorAllocator::allocate(), Tensor::allocator(), ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, FFT1DInfo::axis, FFT2DInfo::axis0, FFT2DInfo::axis1, NEFFT1D::configure(), FFT1DInfo::direction, FFT2DInfo::direction, ITensor::info(), MemoryGroup::manage(), and NEFFT2D::validate().

Referenced by NEFFTConvolutionLayer::configure().

43 {
45  ARM_COMPUTE_ERROR_THROW_ON(NEFFT2D::validate(input->info(), output->info(), config));
46 
47  // Setup first pass
48  FFT1DInfo first_pass_config;
49  first_pass_config.axis = config.axis0;
50  first_pass_config.direction = config.direction;
51  _memory_group.manage(&_first_pass_tensor);
52  _first_pass_func.configure(input, &_first_pass_tensor, first_pass_config);
53 
54  // Setup second pass
55  FFT1DInfo second_pass_config;
56  second_pass_config.axis = config.axis1;
57  second_pass_config.direction = config.direction;
58  _second_pass_func.configure(&_first_pass_tensor, output, second_pass_config);
59  _first_pass_tensor.allocator()->allocate();
60 }
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
TensorAllocator * allocator()
Return a pointer to the tensor&#39;s allocator.
Definition: Tensor.cpp:48
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Definition: MemoryGroup.h:79
void configure(const ITensor *input, ITensor *output, const FFT1DInfo &config)
Initialise the function&#39;s source and destinations.
Definition: NEFFT1D.cpp:43
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const FFT2DInfo &config)
Static function to check if given info will lead to a valid configuration of NEFFT2D.
Definition: NEFFT2D.cpp:62
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ operator=() [1/2]

NEFFT2D& operator= ( const NEFFT2D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEFFT2D& operator= ( NEFFT2D &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 91 of file NEFFT2D.cpp.

References MemoryGroup::acquire(), MemoryGroup::release(), and NEFFT1D::run().

Referenced by NEFFTConvolutionLayer::run().

92 {
93  _memory_group.acquire();
94 
95  _first_pass_func.run();
96  _second_pass_func.run();
97 
98  _memory_group.release();
99 }
void run() override
Run the kernels contained in the function.
Definition: NEFFT1D.cpp:135
void release() override
Releases backing memory of the whole group.
Definition: MemoryGroup.h:115
void acquire() override
Acquires backing memory for the whole group.
Definition: MemoryGroup.h:105

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const FFT2DInfo config 
)
static

Static function to check if given info will lead to a valid configuration of NEFFT2D.

Parameters
[in]inputSource tensor info. Data types supported: F32.
[in]outputDestination tensor info. Data types and data layouts supported: Same as input.
[in]configFFT related configuration
Returns
a status

Definition at line 62 of file NEFFT2D.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES, ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, FFT1DInfo::axis, FFT2DInfo::axis0, FFT2DInfo::axis1, ICloneable< T >::clone(), FFT1DInfo::direction, FFT2DInfo::direction, ITensorInfo::total_size(), and NEFFT1D::validate().

Referenced by NEFFT2D::configure(), and arm_compute::test::validation::FIXTURE_DATA_TEST_CASE().

63 {
65 
66  // Create intermediate tensor info
67  TensorInfo first_pass_tensor(input->clone()->set_is_resizable(true).reset_padding().set_num_channels(2));
68 
69  // Validate first pass
70  FFT1DInfo first_pass_config;
71  first_pass_config.axis = config.axis0;
72  first_pass_config.direction = config.direction;
73  ARM_COMPUTE_RETURN_ON_ERROR(NEFFT1D::validate(input, &first_pass_tensor, first_pass_config));
74 
75  // Validate second pass
76  FFT1DInfo second_pass_config;
77  second_pass_config.axis = config.axis1;
78  second_pass_config.direction = config.direction;
79  ARM_COMPUTE_RETURN_ON_ERROR(NEFFT1D::validate(&first_pass_tensor, output, second_pass_config));
80 
81  // Checks performed when output is configured
82  if((output != nullptr) && (output->total_size() != 0))
83  {
86  }
87 
88  return Status{};
89 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
Definition: Validate.h:443
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Definition: Validate.h:545
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.
Definition: NEFFT1D.cpp:109

The documentation for this class was generated from the following files: