Compute Library
 22.11
NEBitwiseNotKernel Class Reference

Interface for the kernel to perform bitwise NOT operation. More...

#include <NEBitwiseNotKernel.h>

Collaboration diagram for NEBitwiseNotKernel:
[legend]

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Interface for the kernel to perform bitwise NOT operation.

Result is computed by:

\[ output(x,y) = \lnot input(x,y) \]

Definition at line 38 of file NEBitwiseNotKernel.h.

Constructor & Destructor Documentation

◆ NEBitwiseNotKernel() [1/3]

Default constructor.

Definition at line 53 of file NEBitwiseNotKernel.cpp.

Referenced by NEBitwiseNotKernel::name().

54  : _input(nullptr), _output(nullptr)
55 {
56 }

◆ NEBitwiseNotKernel() [2/3]

NEBitwiseNotKernel ( const NEBitwiseNotKernel )
delete

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

◆ NEBitwiseNotKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEBitwiseNotKernel()

~NEBitwiseNotKernel ( )
default

Default destructor.

Referenced by NEBitwiseNotKernel::name().

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output 
)

Initialise the kernel's input and output.

Parameters
[in]inputAn input tensor. Data type supported: U8.
[out]outputThe output tensor. Data type supported: U8.

Definition at line 58 of file NEBitwiseNotKernel.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(), arm_compute::test::validation::input, 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 NEBitwiseNotKernel::name().

59 {
60  ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
61 
62  set_shape_if_empty(*output->info(), input->info()->tensor_shape());
63 
66 
71 
72  _input = input;
73  _output = output;
74 
75  constexpr unsigned int num_elems_processed_per_iteration = 16;
76 
77  // Configure kernel window
78  Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
81 
82  INEKernel::configure(win);
83 }
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]

NEBitwiseNotKernel& operator= ( const NEBitwiseNotKernel )
delete

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

Referenced by NEBitwiseNotKernel::name().

◆ operator=() [2/2]

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

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

Referenced by NEBitwiseNotKernel::name().

86 {
87  ARM_COMPUTE_UNUSED(info);
90  Iterator input(_input, window);
91  Iterator output(_output, window);
92 
93  execute_window_loop(window, [&](const Coordinates &)
94  {
95  bitwise_not_U8_U8(input.ptr(), output.ptr());
96  },
97  input, output);
98 }
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: