Compute Library
 23.11
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...
 
virtual void run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator)
 legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More...
 
virtual void run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info)
 Execute the kernel on the passed window. More...
 
virtual size_t get_mws (const CPUInfo &platform, size_t thread_count) const
 Return minimum workload size of the relevant kernel. 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...
 
bool is_window_configured () const
 Function to check if the embedded window of this kernel has been configured. 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...
 

Additional Inherited Members

- Static Public Attributes inherited from ICPPKernel
static constexpr size_t default_mws = 1
 

Detailed Description

Interface for the digit reverse operation kernel.

Definition at line 37 of file NEFFTDigitReverseKernel.h.

Constructor & Destructor Documentation

◆ NEFFTDigitReverseKernel() [1/3]

Constructor.

Definition at line 78 of file NEFFTDigitReverseKernel.cpp.

78  : _func(nullptr), _input(nullptr), _output(nullptr), _idx(nullptr)
79 {
80 }

◆ 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 82 of file NEFFTDigitReverseKernel.cpp.

86 {
87  ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, idx);
88  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), idx->info(), config));
89 
90  _input = input;
91  _output = output;
92  _idx = idx;
93 
94  const size_t axis = config.axis;
95  const bool is_conj = config.conjugate;
96  const bool is_input_complex = (input->info()->num_channels() == 2);
97 
98  // Configure kernel window
99  auto win_config = validate_and_configure_window(input->info(), output->info(), idx->info(), config);
100  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
101  INEKernel::configure(win_config.second);
102 
103  if (axis == 0)
104  {
105  if (is_input_complex)
106  {
107  if (is_conj)
108  {
109  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<true, true>;
110  }
111  else
112  {
113  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<true, false>;
114  }
115  }
116  else
117  {
118  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_0<false, false>;
119  }
120  }
121  else if (axis == 1)
122  {
123  if (is_input_complex)
124  {
125  if (is_conj)
126  {
127  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<true, true>;
128  }
129  else
130  {
131  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<true, false>;
132  }
133  }
134  else
135  {
136  _func = &NEFFTDigitReverseKernel::digit_reverse_kernel_axis_1<false, false>;
137  }
138  }
139  else
140  {
141  ARM_COMPUTE_ERROR("Not supported");
142  }
143 }

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, FFTDigitReverseKernelInfo::axis, FFTDigitReverseKernelInfo::conjugate, ITensor::info(), arm_compute::test::validation::input, arm_compute::cpu::kernels::validate_and_configure_window(), and arm_compute::cpu::kernels::validate_arguments().

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 40 of file NEFFTDigitReverseKernel.h.

41  {
42  return "NEFFTDigitReverseKernel";
43  }

◆ 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.

Reimplemented from ICPPKernel.

Definition at line 270 of file NEFFTDigitReverseKernel.cpp.

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 145 of file NEFFTDigitReverseKernel.cpp.

149 {
152  validate_and_configure_window(input->clone().get(), output->clone().get(), idx->clone().get(), config).first);
153  return Status{};
154 }

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), arm_compute::test::validation::input, arm_compute::cpu::kernels::validate_and_configure_window(), and arm_compute::cpu::kernels::validate_arguments().


The documentation for this class was generated from the following files:
arm_compute::cpu::kernels::validate_arguments
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
Definition: CpuDirectConv2dKernel.cpp:57
ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:1079
ARM_COMPUTE_ERROR
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:354
ARM_COMPUTE_RETURN_ON_ERROR
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:205
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
ARM_COMPUTE_ERROR_THROW_ON
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:203
arm_compute::cpu::kernels::validate_and_configure_window
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *src, ITensorInfo *dst)
Definition: CpuDirectConv2dKernel.cpp:92
ARM_COMPUTE_UNUSED
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:151
arm_compute::IKernel::window
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486