Compute Library
 19.08
NEComplexPixelWiseMultiplicationKernel Class Reference

Interface for the complex pixelwise multiplication kernel. More...

#include <NEPixelWiseMultiplicationKernel.h>

Collaboration diagram for NEComplexPixelWiseMultiplicationKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEComplexPixelWiseMultiplicationKernel ()
 Default constructor. More...
 
 NEComplexPixelWiseMultiplicationKernel (const NEComplexPixelWiseMultiplicationKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEComplexPixelWiseMultiplicationKerneloperator= (const NEComplexPixelWiseMultiplicationKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEComplexPixelWiseMultiplicationKernel (NEComplexPixelWiseMultiplicationKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEComplexPixelWiseMultiplicationKerneloperator= (NEComplexPixelWiseMultiplicationKernel &&)=default
 Allow instances of this class to be moved. More...
 
void configure (const ITensor *input1, const ITensor *input2, ITensor *output)
 Initialise the kernel's input, output and border mode. More...
 
void run (const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
BorderSize border_size () const override
 The size of the border for that kernel. 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...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of NEComplexPixelWiseMultiplicationKernel. More...
 

Detailed Description

Interface for the complex pixelwise multiplication kernel.

Definition at line 134 of file NEPixelWiseMultiplicationKernel.h.

Constructor & Destructor Documentation

◆ NEComplexPixelWiseMultiplicationKernel() [1/3]

Default constructor.

Definition at line 843 of file NEPixelWiseMultiplicationKernel.cpp.

844  : _input1(nullptr), _input2(nullptr), _output(nullptr)
845 {
846 }

◆ NEComplexPixelWiseMultiplicationKernel() [2/3]

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

◆ NEComplexPixelWiseMultiplicationKernel() [3/3]

Allow instances of this class to be moved.

Member Function Documentation

◆ border_size()

BorderSize border_size ( ) const
overridevirtual

The size of the border for that kernel.

Returns
The width in number of elements of the border.

Reimplemented from IKernel.

Definition at line 891 of file NEPixelWiseMultiplicationKernel.cpp.

892 {
893  const unsigned int replicateSize = _output->info()->dimension(0) - std::min(_input1->info()->dimension(0), _input2->info()->dimension(0));
894  const unsigned int border = std::min<unsigned int>(num_elems_processed_per_iteration_complex - 1U, replicateSize);
895  return { 0, border, 0, 0 };
896 }
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.

References ITensorInfo::dimension(), ITensor::info(), and arm_compute::U.

◆ configure()

void configure ( const ITensor input1,
const ITensor input2,
ITensor output 
)

Initialise the kernel's input, output and border mode.

Parameters
[in]input1An input tensor. Data types supported: F32. Number of channels supported: 2 (complex tensor).
[in]input2An input tensor. Data types supported: same as input1. Number of channels supported: same as input1.
[out]outputThe output tensor, Data types supported: same as input1. Number of channels supported: same as input1.

Definition at line 848 of file NEPixelWiseMultiplicationKernel.cpp.

849 {
850  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
851  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_complex(input1->info(), input2->info(), output->info()));
852 
853  // Configure kernel window
854  auto win_config = validate_and_configure_window_complex(input1->info(), input2->info(), output->info());
855  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
856 
857  _input1 = input1;
858  _input2 = input2;
859  _output = output;
860 
861  // Create kernel
862  INEKernel::configure(win_config.second);
863 }
#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, and ITensor::info().

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 137 of file NEPixelWiseMultiplicationKernel.h.

138  {
139  return "NEComplexPixelWiseMultiplicationKernel";
140  }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Allow instances of this class to be moved.

◆ 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 874 of file NEPixelWiseMultiplicationKernel.cpp.

875 {
879 
880  Iterator input1(_input1, window.broadcast_if_dimension_le_one(_input1->info()->tensor_shape()));
881  Iterator input2(_input2, window.broadcast_if_dimension_le_one(_input2->info()->tensor_shape()));
882  Iterator output(_output, window);
883 
884  execute_window_loop(window, [&](const Coordinates &)
885  {
886  c_mul_F32_F32_F32_n(input1.ptr(), input2.ptr(), output.ptr());
887  },
888  input1, input2, output);
889 }
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
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Window broadcast_if_dimension_le_one(const TensorShape &shape) const
Don't advance in the dimension where shape is less equal to 1.
Definition: Window.inl:106
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::broadcast_if_dimension_le_one(), arm_compute::execute_window_loop(), ITensor::info(), arm_compute::test::validation::info, Iterator::ptr(), ITensorInfo::tensor_shape(), and IKernel::window().

◆ validate()

Status validate ( const ITensorInfo input1,
const ITensorInfo input2,
const ITensorInfo output 
)
static

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

Parameters
[in]input1An input tensor info. Data types supported: F32. Number of channels supported: 2 (complex tensor).
[in]input2An input tensor info. Data types supported: same as input1. Number of channels supported: same as input1.
[in]outputThe output tensor info. Data types supported: same as input1. Number of channels supported: same as input1.
Returns
a status

Definition at line 865 of file NEPixelWiseMultiplicationKernel.cpp.

866 {
867  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
868  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments_complex(input1, input2, output));
869  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window_complex(input1->clone().get(), input2->clone().get(), output->clone().get()).first);
870 
871  return Status{};
872 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:193
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

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

Referenced by NEComplexPixelWiseMultiplication::validate().


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