Compute Library
 19.08
NEFFTScaleKernel Class Reference

Interface for the inverse fft scale kernel. More...

#include <NEFFTScaleKernel.h>

Collaboration diagram for NEFFTScaleKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEFFTScaleKernel ()
 Constructor. More...
 
 NEFFTScaleKernel (const NEFFTScaleKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEFFTScaleKerneloperator= (const NEFFTScaleKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEFFTScaleKernel (NEFFTScaleKernel &&)=default
 Default Move Constructor. More...
 
NEFFTScaleKerneloperator= (NEFFTScaleKernel &&)=default
 Default move assignment operator. More...
 
 ~NEFFTScaleKernel ()=default
 Default destructor. More...
 
void configure (ITensor *input, ITensor *output, const FFTScaleKernelInfo &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 FFTScaleKernelInfo &config)
 Static function to check if given info will lead to a valid configuration of NEFFTScaleKernel. More...
 

Detailed Description

Interface for the inverse fft scale kernel.

Definition at line 37 of file NEFFTScaleKernel.h.

Constructor & Destructor Documentation

◆ NEFFTScaleKernel() [1/3]

Constructor.

Definition at line 87 of file NEFFTScaleKernel.cpp.

88  : _input(nullptr), _output(nullptr), _scale(), _run_in_place(false), _is_conj(false)
89 {
90 }

◆ NEFFTScaleKernel() [2/3]

NEFFTScaleKernel ( const NEFFTScaleKernel )
delete

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

◆ NEFFTScaleKernel() [3/3]

Default Move Constructor.

◆ ~NEFFTScaleKernel()

~NEFFTScaleKernel ( )
default

Default destructor.

Member Function Documentation

◆ configure()

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

Set the input and output tensors.

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

Definition at line 92 of file NEFFTScaleKernel.cpp.

93 {
95  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (output != nullptr) ? output->info() : nullptr));
96 
97  _input = input;
98  _output = output;
99  _run_in_place = (output == nullptr) || (output == input);
100  _is_conj = config.conjugate;
101  _scale = config.scale;
102 
103  // Configure kernel window
104  auto win_config = validate_and_configure_window(input->info(), _run_in_place ? nullptr : output->info());
105  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
106  INEKernel::configure(win_config.second);
107 }
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_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, FFTScaleKernelInfo::conjugate, ITensor::info(), FFTScaleKernelInfo::scale, 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 40 of file NEFFTScaleKernel.h.

41  {
42  return "NEFFTScaleKernel";
43  }

◆ operator=() [1/2]

NEFFTScaleKernel& operator= ( const NEFFTScaleKernel )
delete

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

◆ operator=() [2/2]

NEFFTScaleKernel& operator= ( NEFFTScaleKernel &&  )
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 118 of file NEFFTScaleKernel.cpp.

119 {
123 
124  Window input_window = window;
125  input_window.set(Window::DimX, 0);
126 
127  Iterator in(_input, input_window);
128  Iterator out(_run_in_place ? _input : _output, input_window);
129 
130  execute_window_loop(window, [&](const Coordinates &)
131  {
132  scale_complex(reinterpret_cast<float *>(in.ptr()), reinterpret_cast<float *>(out.ptr()), _is_conj, _scale);
133  },
134  in, out);
135 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Definition: Window.inl:48
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:122
#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, Window::DimX, arm_compute::execute_window_loop(), arm_compute::test::validation::info, Iterator::ptr(), Window::set(), and IKernel::window().

◆ validate()

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

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

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

Definition at line 109 of file NEFFTScaleKernel.cpp.

110 {
111  ARM_COMPUTE_UNUSED(config);
112  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output));
113  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get()).first);
114 
115  return Status{};
116 }
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
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160

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


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