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

#include <NEQuantizationSymmetricKernel.h>

Collaboration diagram for arm_compute::NEQuantizationSymmetricKernel:

Public Member Functions

const char * name () const override
 
 NEQuantizationSymmetricKernel ()
 
 NEQuantizationSymmetricKernel (const NEQuantizationSymmetricKernel &)=delete
 
NEQuantizationSymmetricKerneloperator= (const NEQuantizationSymmetricKernel &)=delete
 
 NEQuantizationSymmetricKernel (NEQuantizationSymmetricKernel &&)=default
 
NEQuantizationSymmetricKerneloperator= (NEQuantizationSymmetricKernel &&)=default
 
 ~NEQuantizationSymmetricKernel ()=default
 
void configure (const ITensor *input, ITensor *output, ITensor *scale_factor)
 
void run (const Window &window, const ThreadInfo &info) override
 

Static Public Member Functions

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

Detailed Description

Interface for the dequantization layer kernel.

Definition at line 51 of file NEQuantizationSymmetricKernel.h.

Constructor & Destructor Documentation

◆ NEQuantizationSymmetricKernel() [1/3]

NEQuantizationSymmetricKernel::NEQuantizationSymmetricKernel ( )

Default constructor

Definition at line 130 of file NEQuantizationSymmetricKernel.cpp.

131 : _input(nullptr), _output(nullptr), _scale_factor(nullptr)
132{
133}

◆ NEQuantizationSymmetricKernel() [2/3]

arm_compute::NEQuantizationSymmetricKernel::NEQuantizationSymmetricKernel ( const NEQuantizationSymmetricKernel )
delete

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

◆ NEQuantizationSymmetricKernel() [3/3]

arm_compute::NEQuantizationSymmetricKernel::NEQuantizationSymmetricKernel ( NEQuantizationSymmetricKernel &&  )
default

Default Move Constructor.

◆ ~NEQuantizationSymmetricKernel()

arm_compute::NEQuantizationSymmetricKernel::~NEQuantizationSymmetricKernel ( )
default

Default destructor

References validate().

Member Function Documentation

◆ configure()

void NEQuantizationSymmetricKernel::configure ( const ITensor *  input,
ITensor *  output,
ITensor *  scale_factor 
)

Set input, output tensors.

Parameters
[in]inputSource tensor. Data type supported: F16/F32.
[out]outputDestination tensor with the same dimensions of input. Data type supported: S8.
[out]scale_factorScale tensor of output. Data type supported: Same as input.

Definition at line 135 of file NEQuantizationSymmetricKernel.cpp.

137{
138 ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
139 ARM_COMPUTE_ERROR_THROW_ON(
140 validate_arguments(input->info(), output->info(), scale_factor->info()));
141
142 _input = input;
143 _output = output;
144 _scale_factor = scale_factor;
145
146 // Configure kernel window
147 Window win_config = calculate_max_window(*input->info(), Steps());
148
149 Coordinates coord;
150 coord.set_num_dimensions(output->info()->num_dimensions());
151 output->info()->set_valid_region(ValidRegion(coord, output->info()->tensor_shape()));
152
153 INEKernel::configure(win_config);
154}

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

◆ name()

const char * arm_compute::NEQuantizationSymmetricKernel::name ( ) const
inlineoverride

Definition at line 54 of file NEQuantizationSymmetricKernel.h.

54{ return "NEQuantizationSymmetricKernel"; }

◆ operator=() [1/2]

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

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

◆ operator=() [2/2]

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

Default move assignment operator

◆ run()

void NEQuantizationSymmetricKernel::run ( const Window &  window,
const ThreadInfo &  info 
)
override

Definition at line 220 of file NEQuantizationSymmetricKernel.cpp.

221{
222 ARM_COMPUTE_UNUSED(info);
223 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
224 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
225
226 switch (_input->info()->data_type())
227 {
228 case DataType::F32:
229 NEQuantizationSymmetricKernel::quantize<float>(window);
230 break;
231#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
232 case DataType::F16:
233 NEQuantizationSymmetricKernel::quantize<float16_t>(window);
234 break;
235#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
236 default:
237 ARM_COMPUTE_ERROR("Unsupported data type.");
238 }
239}
volatile const char info[]

References info.

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

◆ validate()

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

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

Parameters
[in]inputInput tensor info. Data types supported: F16/F32.
[in]outputOutput tensor info. Data types supported: S8.
[out]scale_factorScale tensor of output. Data type supported: Same as input.
Returns
a status

Definition at line 156 of file NEQuantizationSymmetricKernel.cpp.

158{
159 ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, scale_factor));
160
161 return Status{};
162}

Referenced by arm_compute::NEFullyConnectedHybridLayer::validate(), and ~NEQuantizationSymmetricKernel().


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