Compute Library
 21.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...
 
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...
 
- 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 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 86 of file NEFFTScaleKernel.cpp.

Referenced by NEFFTScaleKernel::name().

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

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

Referenced by NEFFTScaleKernel::name().

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 91 of file NEFFTScaleKernel.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, FFTScaleKernelInfo::conjugate, ITensor::info(), arm_compute::test::validation::input, and FFTScaleKernelInfo::scale.

Referenced by NEFFTScaleKernel::name().

92 {
94  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (output != nullptr) ? output->info() : nullptr));
95 
96  _input = input;
97  _output = output;
98  _run_in_place = (output == nullptr) || (output == input);
99  _is_conj = config.conjugate;
100  _scale = config.scale;
101 
102  // Configure kernel window
103  auto win_config = validate_and_configure_window(input->info(), _run_in_place ? nullptr : output->info());
104  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
105  INEKernel::configure(win_config.second);
106 }
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

◆ name()

const char* name ( ) const
inlineoverridevirtual

◆ operator=() [1/2]

NEFFTScaleKernel& operator= ( const NEFFTScaleKernel )
delete

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

Referenced by NEFFTScaleKernel::name().

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

Reimplemented from ICPPKernel.

Definition at line 117 of file NEFFTScaleKernel.cpp.

References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, Window::DimX, arm_compute::execute_window_loop(), Iterator::ptr(), Window::set(), and IKernel::window().

Referenced by NEFFTScaleKernel::name().

118 {
122 
123  Window input_window = window;
124  input_window.set(Window::DimX, 0);
125 
126  Iterator in(_input, input_window);
127  Iterator out(_run_in_place ? _input : _output, input_window);
128 
129  execute_window_loop(window, [&](const Coordinates &)
130  {
131  scale_complex(reinterpret_cast<float *>(in.ptr()), reinterpret_cast<float *>(out.ptr()), _is_conj, _scale);
132  },
133  in, out);
134 }
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:152
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Definition: Window.inl:49
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:915
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
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:77
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:201

◆ 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 108 of file NEFFTScaleKernel.cpp.

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

Referenced by NEFFTScaleKernel::name().

109 {
110  ARM_COMPUTE_UNUSED(config);
111  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output));
112  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get()).first);
113 
114  return Status{};
115 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

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