Compute Library
 21.08
NEBitwiseOrKernel Class Reference

Interface for the kernel to perform bitwise inclusive OR between two tensors. More...

#include <NEBitwiseOrKernel.h>

Collaboration diagram for NEBitwiseOrKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEBitwiseOrKernel ()
 Default constructor. More...
 
 NEBitwiseOrKernel (const NEBitwiseOrKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEBitwiseOrKerneloperator= (const NEBitwiseOrKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEBitwiseOrKernel (NEBitwiseOrKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEBitwiseOrKerneloperator= (NEBitwiseOrKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEBitwiseOrKernel ()=default
 Default destructor. More...
 
void configure (const ITensor *input1, const ITensor *input2, ITensor *output)
 Initialise the kernel's inputs and output. 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...
 

Detailed Description

Interface for the kernel to perform bitwise inclusive OR between two tensors.

Result is computed by:

\[ output(x,y) = input1(x,y) \lor input2(x,y) \]

Definition at line 38 of file NEBitwiseOrKernel.h.

Constructor & Destructor Documentation

◆ NEBitwiseOrKernel() [1/3]

Default constructor.

Definition at line 54 of file NEBitwiseOrKernel.cpp.

Referenced by NEBitwiseOrKernel::name().

55  : _input1(nullptr), _input2(nullptr), _output(nullptr)
56 {
57 }

◆ NEBitwiseOrKernel() [2/3]

NEBitwiseOrKernel ( const NEBitwiseOrKernel )
delete

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

◆ NEBitwiseOrKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEBitwiseOrKernel()

~NEBitwiseOrKernel ( )
default

Default destructor.

Referenced by NEBitwiseOrKernel::name().

Member Function Documentation

◆ configure()

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

Initialise the kernel's inputs and output.

Parameters
[in]input1An input tensor. Data type supported: U8.
[in]input2An input tensor. Data type supported: U8
[out]outputOutput tensor. Data type supported: U8.

Definition at line 59 of file NEBitwiseOrKernel.cpp.

References ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES, ARM_COMPUTE_ERROR_ON_NULLPTR, arm_compute::calculate_max_window(), arm_compute::test::validation::configure(), ITensor::info(), num_elems_processed_per_iteration, arm_compute::set_format_if_unknown(), arm_compute::set_shape_if_empty(), ITensorInfo::tensor_shape(), arm_compute::U8, and arm_compute::update_window_and_padding().

Referenced by NEBitwiseOrKernel::name().

60 {
61  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
62 
63  set_shape_if_empty(*output->info(), input1->info()->tensor_shape());
64 
68 
69  ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(input1, input2, output);
73  ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input1, input2, output);
74 
75  _input1 = input1;
76  _input2 = input2;
77  _output = output;
78 
79  constexpr unsigned int num_elems_processed_per_iteration = 16;
80 
81  // Configure kernel window
82  Window win = calculate_max_window(*input1->info(), Steps(num_elems_processed_per_iteration));
84 
88  output_access);
89 
90  INEKernel::configure(win);
91 }
bool set_format_if_unknown(ITensorInfo &info, Format format)
Set the format, data type and number of channels to the specified value if the current data type is u...
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
1 channel, 1 U8 per channel
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
Definition: WindowHelpers.h:46
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Definition: Validate.h:539
Class to describe a number of elements in each dimension.
Definition: Steps.h:40
Implementation of a row access pattern.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(...)
Definition: Validate.h:437
unsigned int num_elems_processed_per_iteration
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
bool set_shape_if_empty(ITensorInfo &info, const TensorShape &shape)
Set the shape to the specified value if the current assignment is empty.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:786
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
Describe a multidimensional execution window.
Definition: Window.h:39

◆ name()

const char* name ( ) const
inlineoverridevirtual

◆ operator=() [1/2]

NEBitwiseOrKernel& operator= ( const NEBitwiseOrKernel )
delete

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

Referenced by NEBitwiseOrKernel::name().

◆ operator=() [2/2]

NEBitwiseOrKernel& operator= ( NEBitwiseOrKernel &&  )
default

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.

Reimplemented from ICPPKernel.

Definition at line 93 of file NEBitwiseOrKernel.cpp.

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

Referenced by NEBitwiseOrKernel::name().

94 {
95  ARM_COMPUTE_UNUSED(info);
98  Iterator input1(_input1, window);
99  Iterator input2(_input2, window);
100  Iterator output(_output, window);
101 
102  execute_window_loop(window, [&](const Coordinates &)
103  {
104  bitwise_or_U8_U8_U8(input1.ptr(), input2.ptr(), output.ptr());
105  },
106  input1, input2, output);
107 }
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:152
Coordinates of an item.
Definition: Coordinates.h:37
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:915
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
Iterator updated by execute_window_loop for each window element.
Definition: Helpers.h:46
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:201

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