Compute Library
 19.08
CLGEMMLowpQuantizeDownInt32ToUint8Scale Class Reference

Basic function to execute CLGEMMLowpQuantizeDownInt32ToUint8Scale on OpenCL. More...

#include <CLGEMMLowpOutputStage.h>

Collaboration diagram for CLGEMMLowpQuantizeDownInt32ToUint8Scale:
[legend]

Public Member Functions

void configure (const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, int result_offset, int result_mult_int, int result_shift, int min=0, int max=0)
 Initialise the kernel's inputs, output. More...
 
- Public Member Functions inherited from ICLSimpleFunction
 ICLSimpleFunction ()
 Default constructor. More...
 
void run () override final
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, int min=0, int max=0)
 Static function to check if given info will lead to a valid configuration of CLGEMMLowpQuantizeDownInt32ToUint8Scale. More...
 

Detailed Description

Basic function to execute CLGEMMLowpQuantizeDownInt32ToUint8Scale on OpenCL.

CLGEMMLowpQuantizeDownInt32ToUint8Scale depends on 3 parameters: result_offset, result_mult_int, result_shift The final result is:

((input[i][k] + result_offset) * result_mult_int) >> result_shift

In case the bias tensor is provided, the final result is:

((input[i][k] + bias[k] + result_offset) * result_mult_int) >> result_shift

This function calls the following OpenCL kernels:

  1. CLGEMMLowpQuantizeDownInt32ToUint8ScaleKernel
Note
The function accepts also 2 optional input arguments (min and max) which can be used to implement "rectified linear unit" activation functions after the result is shifted right by result_shift

Definition at line 59 of file CLGEMMLowpOutputStage.h.

Member Function Documentation

◆ configure()

void configure ( const ICLTensor input,
const ICLTensor bias,
ICLTensor output,
int  result_offset,
int  result_mult_int,
int  result_shift,
int  min = 0,
int  max = 0 
)

Initialise the kernel's inputs, output.

Parameters
[in]inputInput tensor. It is the output of CLGEMMLowpMatrixMultiplyCore function. Data type supported: S32
[in]biasBiases tensor. Only shared biases supported and it can be a nullptr if the addition of biases is not required. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as input.
[out]outputOutput tensor. Data type supported: Data type supported: QASYMM8
[in]result_offsetOffset to be added to each element of the input matrix
[in]result_mult_intValue to be multiplied to each element of the input matrix when once the result_offset has been add
[in]result_shiftNumber of bits to shift right the result before converting back to QASYMM8
[in]min(Optional) Min value used to saturate down the output result before converting back to QASYMM8
[in]max(Optional) Max value used to saturate up the output result before converting back to QASYMM8, Along with min, this value can be used to implement "rectified linear unit" activation functions

Definition at line 35 of file CLGEMMLowpOutputStage.cpp.

36 {
37  auto k = arm_compute::support::cpp14::make_unique<CLGEMMLowpQuantizeDownInt32ToUint8ScaleKernel>();
38  k->configure(input, bias, output, result_offset, result_mult_int, result_shift, min, max);
39  _kernel = std::move(k);
40 }

References arm_compute::test::validation::bias.

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo bias,
const ITensorInfo output,
int  min = 0,
int  max = 0 
)
static

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

Parameters
[in]inputInput tensor. It is the output of CLGEMMLowpMatrixMultiplyCore function. Data type supported: S32
[in]biasBiases tensor. Only shared biases supported and it can be a nullptr if the addition of biases is not required. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as input.
[in]outputOutput tensor. Data type supported: Data type supported: QASYMM8
[in]min(Optional) Min value used to saturate down the output result before converting back to QASYMM8
[in]max(Optional) Max value used to saturate up the output result before converting back to QASYMM8, Along with min, this value can be used to implement "rectified linear unit" activation functions
Returns
a status

Definition at line 42 of file CLGEMMLowpOutputStage.cpp.

43 {
44  return CLGEMMLowpQuantizeDownInt32ToUint8ScaleKernel::validate(input, bias, output, min, max);
45 }
static Status validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, int min=0, int max=0)
Static function to check if given info will lead to a valid configuration of CLGEMMLowpQuantizeDownIn...

References arm_compute::test::validation::bias, and CLGEMMLowpQuantizeDownInt32ToUint8ScaleKernel::validate().


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