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

#include <CLScaleFactorSymm8Kernel.h>

Collaboration diagram for arm_compute::CLScaleFactorSymm8Kernel:

Public Member Functions

 CLScaleFactorSymm8Kernel ()
 
 CLScaleFactorSymm8Kernel (const CLScaleFactorSymm8Kernel &)=delete
 
CLScaleFactorSymm8Kerneloperator= (const CLScaleFactorSymm8Kernel &)=delete
 
 CLScaleFactorSymm8Kernel (CLScaleFactorSymm8Kernel &&)=default
 
CLScaleFactorSymm8Kerneloperator= (CLScaleFactorSymm8Kernel &&)=default
 
void configure (const ICLTensor *input, ICLTensor *output)
 
void reset (cl::CommandQueue &queue)
 
void run (const Window &window, cl::CommandQueue &queue) override
 

Static Public Member Functions

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

Detailed Description

Interface for the kernel to perform min max search on a 3D tensor.

Definition at line 52 of file CLScaleFactorSymm8Kernel.h.

Constructor & Destructor Documentation

◆ CLScaleFactorSymm8Kernel() [1/3]

CLScaleFactorSymm8Kernel::CLScaleFactorSymm8Kernel ( )

Default constructor

Definition at line 107 of file CLScaleFactorSymm8Kernel.cpp.

107: _input(nullptr), _output(nullptr) {}

◆ CLScaleFactorSymm8Kernel() [2/3]

arm_compute::CLScaleFactorSymm8Kernel::CLScaleFactorSymm8Kernel ( const CLScaleFactorSymm8Kernel )
delete

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

◆ CLScaleFactorSymm8Kernel() [3/3]

arm_compute::CLScaleFactorSymm8Kernel::CLScaleFactorSymm8Kernel ( CLScaleFactorSymm8Kernel &&  )
default

Allow instances of this class to be moved

Member Function Documentation

◆ configure()

void CLScaleFactorSymm8Kernel::configure ( const ICLTensor *  input,
ICLTensor *  output 
)

Initialise the kernel's input and output.

Parameters
[in]inputInput tensor with 2 dimensions. The first dimension will be interpreted as batches. Data types supported: F32.
[out]outputOutput tensor with shape [batches] which stores the scale values for each 2D input tensor. The dimensions over the first must match the batched dimensions of the input tensor. Data types supported: F32.

Definition at line 109 of file CLScaleFactorSymm8Kernel.cpp.

110{
111 ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
112 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info()));
113
114 _input = input;
115 _output = output;
116
117 std::set<std::string> build_opts;
118 build_opts.emplace("-DWIDTH=" + support::cpp11::to_string(input->info()->dimension(0)));
119
120 // Create kernel
121 _kernel = static_cast<cl::Kernel>(
122 CLKernelLibraryEx::get().create_kernel("scale_factor_symm8", build_opts));
123
124 auto win_config = validate_and_configure_window(input->info(), output->info());
125
126 ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
127
128 ICLKernel::configure_internal(std::get<1>(win_config));
129}
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().

Referenced by arm_compute::CLFullyConnectedHybridLayer::configure().

◆ operator=() [1/2]

CLScaleFactorSymm8Kernel & arm_compute::CLScaleFactorSymm8Kernel::operator= ( CLScaleFactorSymm8Kernel &&  )
default

Allow instances of this class to be moved

References validate().

◆ operator=() [2/2]

CLScaleFactorSymm8Kernel & arm_compute::CLScaleFactorSymm8Kernel::operator= ( const CLScaleFactorSymm8Kernel )
delete

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

◆ reset()

void arm_compute::CLScaleFactorSymm8Kernel::reset ( cl::CommandQueue &  queue)

Resets global minimum and maximum

Parameters
[in,out]queueCommand queue on which to map and unmap the min_max tensor

◆ run()

void CLScaleFactorSymm8Kernel::run ( const Window &  window,
cl::CommandQueue &  queue 
)
override

Definition at line 140 of file CLScaleFactorSymm8Kernel.cpp.

141{
142 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
143 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window);
144
145 Window window_collapsed = window.collapse_if_possible(ICLKernel::window(), Window::DimZ);
146 Window slice = window_collapsed.first_slice_window_2D();
147 slice.set(Window::DimX, Window::Dimension(0, 1, 1));
148
149 do
150 {
151 Window output_slice = slice.shift_dimensions(1);
152
153 unsigned int idx = 0;
154 // Set inputs
155 add_2D_tensor_argument(idx, _input, slice);
156 add_1D_tensor_argument(idx, _output, output_slice);
157 enqueue(queue, *this, slice, lws_hint());
158 } while (window_collapsed.slide_window_slice_2D(slice));
159}

Referenced by package.infer.session::inference().

◆ validate()

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

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

Parameters
[in]inputInput tensor info. Data types supported: F32.
[in]outputOutput tensor info with shape [batches] which stores the scale values for each 2D input tensor. The dimensions over the first must match the batched dimensions of the input tensor. Data types supported: F32.
Returns
a status

Definition at line 131 of file CLScaleFactorSymm8Kernel.cpp.

132{
133 ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output));
134 ARM_COMPUTE_RETURN_ON_ERROR(
135 std::get<0>(validate_and_configure_window(input->clone().get(), output->clone().get())));
136
137 return Status{};
138}

Referenced by operator=(), and arm_compute::CLFullyConnectedHybridLayer::validate().


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