ONE - On-device Neural Engine
Loading...
Searching...
No Matches
arm_compute::CLCastBoolKernel Class Reference

Class for the kernel converting boolean type. More...

#include <CLCastBoolKernel.h>

Collaboration diagram for arm_compute::CLCastBoolKernel:

Public Member Functions

void configure (const ICLTensor *input, ICLTensor *output)
 Initialise the kernel's input and output.
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output)
 

Detailed Description

Class for the kernel converting boolean type.

Definition at line 59 of file CLCastBoolKernel.h.

Member Function Documentation

◆ configure()

void arm_compute::CLCastBoolKernel::configure ( const ICLTensor *  input,
ICLTensor *  output 
)

Initialise the kernel's input and output.

Parameters
[in]inputInput tensor. Data types supported: U8
[in]outputOutput tensor. Data types supported: U8/QASYMM8/S16/S32/F16/F32.
Returns
N/A

Definition at line 85 of file CLCastBoolKernel.cpp.

86{
87 ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
88
89 // Auto initialize output shape if not initialized (We can only auto-configure the shape, datatype
90 // must be given)
91 set_shape_if_empty(*output->info(), input->info()->tensor_shape());
92
93 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info()));
94
95 // Get number of elements to process per iterations
96 constexpr unsigned int num_elems_processed_per_iteration = 16;
97
98 // Set build options
99 CLBuildOptions build_opts;
100 build_opts.add_option("-DVEC_SIZE=" +
101 support::cpp11::to_string(num_elems_processed_per_iteration));
102 build_opts.add_option("-DDATA_TYPE_IN=" + get_cl_type_from_data_type(input->info()->data_type()));
103 build_opts.add_option("-DDATA_TYPE_OUT=" +
104 get_cl_type_from_data_type(output->info()->data_type()));
105
106 // Create kernel
107 const std::string kernel_name = "cast_bool";
108 _kernel = static_cast<cl::Kernel>(
109 CLKernelLibraryEx::get().create_kernel(kernel_name, build_opts.options()));
110
111 // Configure kernel
112 ICLSimple2DKernel::configure(input, output, num_elems_processed_per_iteration);
113
114 // Collapse window
115 const Window &full_window = window();
116 Window collapsed_window = full_window.collapse_if_possible(full_window, Window::DimZ);
117 ICLKernel::configure_internal(collapsed_window);
118
119 // Set config_id for enabling LWS tuning
120 _config_id = kernel_name;
121 _config_id += "_";
122 _config_id += lower_string(string_from_data_type(output->info()->data_type()));
123 _config_id += "_";
124 _config_id += support::cpp11::to_string(output->info()->dimension(0));
125 _config_id += "_";
126 _config_id += support::cpp11::to_string(output->info()->dimension(1));
127}
static CLKernelLibraryEx & get()
Get the KernelLibrary singleton.
Kernel create_kernel(const std::string &kernel_name, const StringSet &build_options_set={}) const
Create a kernel from the kernel library.

References arm_compute::CLKernelLibraryEx::create_kernel(), and arm_compute::CLKernelLibraryEx::get().

◆ validate()

Status arm_compute::CLCastBoolKernel::validate ( const ITensorInfo *  input,
const ITensorInfo *  output 
)
static

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

Parameters
[in]inputSource tensor info. Data types supported: U8.
[in]outputDestination tensor info. Data type supported: U8/S8/U16/S16/U32/S32/F16/F32.
Returns
a status

Definition at line 129 of file CLCastBoolKernel.cpp.

130{
131 ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output));
132
133 return Status{};
134}

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