Compute Library
 19.08
NEFFTDigitReverseKernel Class Reference

Interface for the digit reverse operation kernel. More...

#include <NEFFTDigitReverseKernel.h>

Collaboration diagram for NEFFTDigitReverseKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEFFTDigitReverseKernel ()
 Constructor. More...
 
 NEFFTDigitReverseKernel (const NEFFTDigitReverseKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEFFTDigitReverseKerneloperator= (const NEFFTDigitReverseKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEFFTDigitReverseKernel (NEFFTDigitReverseKernel &&)=default
 Default Move Constructor. More...
 
NEFFTDigitReverseKerneloperator= (NEFFTDigitReverseKernel &&)=default
 Default move assignment operator. More...
 
 ~NEFFTDigitReverseKernel ()=default
 Default destructor. More...
 
void configure (const ITensor *input, ITensor *output, const ITensor *idx, const FFTDigitReverseKernelInfo &config)
 Set the input and output tensors. More...
 
void run (const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual bool is_parallelisable () const
 Indicates whether or not the kernel is parallelisable. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 

Static Public Member Functions

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

Detailed Description

Interface for the digit reverse operation kernel.

Definition at line 36 of file NEFFTDigitReverseKernel.h.

Constructor & Destructor Documentation

◆ NEFFTDigitReverseKernel() [1/3]

Constructor.

Definition at line 70 of file NEFFTDigitReverseKernel.cpp.

71  : _func(nullptr), _input(nullptr), _output(nullptr), _idx(nullptr)
72 {
73 }

◆ NEFFTDigitReverseKernel() [2/3]

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

◆ NEFFTDigitReverseKernel() [3/3]

Default Move Constructor.

◆ ~NEFFTDigitReverseKernel()

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
const ITensor idx,
const FFTDigitReverseKernelInfo config 
)

Set the input and output tensors.

Parameters
[in]inputSource tensor. Data types supported: F32. Number of channels supported: 1 (real tensor) or 2 (complex tensor).
[out]outputDestination tensor. Data type supported: same as input. Number of channels supported: 2 (complex tensor).
[in]idxDigit reverse index tensor. Data type supported: U32
[in]configKernel configuration.

Definition at line 75 of file NEFFTDigitReverseKernel.cpp.

76 {
77  ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, idx);
78  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), idx->info(), config));
79 
80  _input = input;
81  _output = output;
82  _idx = idx;
83 
84  const size_t axis = config.axis;
85  const bool is_conj = config.conjugate;
86  const bool is_input_complex = (input->info()->num_channels() == 2);
87 
88  // Configure kernel window
89  auto win_config = validate_and_configure_window(input->info(), output->info(), idx->info(), config);
90  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
91  INEKernel::configure(win_config.second);
92 
93  if(axis == 0)
94  {
95  if(is_input_complex)
96  {
97  if(is_conj)
98  {
99  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<true, true>;
100  }
101  else
102  {
103  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<true, false>;
104  }
105  }
106  else
107  {
108  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<false, false>;
109  }
110  }
111  else if(axis == 1)
112  {
113  if(is_input_complex)
114  {
115  if(is_conj)
116  {
117  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<true, true>;
118  }
119  else
120  {
121  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<true, false>;
122  }
123  }
124  else
125  {
126  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<false, false>;
127  }
128  }
129  else
130  {
131  ARM_COMPUTE_ERROR("Not supported");
132  }
133 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:261
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:327
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, FFTDigitReverseKernelInfo::axis, arm_compute::test::validation::axis, FFTDigitReverseKernelInfo::conjugate, ITensor::info(), ITensorInfo::num_channels(), and arm_compute::validate_and_configure_window().

Referenced by NEFFT1D::configure().

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 39 of file NEFFTDigitReverseKernel.h.

40  {
41  return "NEFFTDigitReverseKernel";
42  }

◆ operator=() [1/2]

NEFFTDigitReverseKernel& operator= ( const NEFFTDigitReverseKernel )
delete

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

◆ operator=() [2/2]

NEFFTDigitReverseKernel& operator= ( NEFFTDigitReverseKernel &&  )
default

Default move assignment operator.

◆ run()

void run ( const Window window,
const ThreadInfo info 
)
overridevirtual

Execute the kernel on the passed window.

Warning
If is_parallelisable() returns false then the passed window must be equal to window()
Note
The window has to be a region within the window returned by the window() method
The width of the window has to be a multiple of num_elems_processed_per_iteration().
Parameters
[in]windowRegion on which to execute the kernel. (Must be a region of the window returned by window())
[in]infoInfo about executing thread and CPU.

Implements ICPPKernel.

Definition at line 252 of file NEFFTDigitReverseKernel.cpp.

253 {
257  (this->*_func)(window);
258 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:940

References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, arm_compute::test::validation::info, and IKernel::window().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const ITensorInfo idx,
const FFTDigitReverseKernelInfo config 
)
static

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

Parameters
[in]inputSource tensor info. Data types supported: F32. Number of channels supported: 1 (real tensor) or 2 (complex tensor).
[in]outputDestination tensor info. Data type supported: same as input. Number of channels supported: 2 (complex tensor).
[in]idxDigit reverse index tensor info. Data type supported: U32
[in]configKernel configuration
Returns
a status

Definition at line 135 of file NEFFTDigitReverseKernel.cpp.

136 {
137  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, idx, config));
138  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), idx->clone().get(), config).first);
139  return Status{};
140 }
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:193

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), and arm_compute::validate_and_configure_window().


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