Compute Library
 21.02
NEDequantizationLayerKernel Class Reference

Interface for the dequantization layer kernel. More...

#include <NEDequantizationLayerKernel.h>

Collaboration diagram for NEDequantizationLayerKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEDequantizationLayerKernel ()
 Default constructor. More...
 
 NEDequantizationLayerKernel (const NEDequantizationLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEDequantizationLayerKerneloperator= (const NEDequantizationLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEDequantizationLayerKernel (NEDequantizationLayerKernel &&)=default
 Default Move Constructor. More...
 
NEDequantizationLayerKerneloperator= (NEDequantizationLayerKernel &&)=default
 Default move assignment operator. More...
 
 ~NEDequantizationLayerKernel ()=default
 Default destructor. More...
 
void configure (const ITensor *input, ITensor *output)
 Set input, output tensors. 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...
 
- 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...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of NEDequantizationLayerKernel. More...
 

Detailed Description

Interface for the dequantization layer kernel.

Definition at line 34 of file NEDequantizationLayerKernel.h.

Constructor & Destructor Documentation

◆ NEDequantizationLayerKernel() [1/3]

Default constructor.

Definition at line 365 of file NEDequantizationLayerKernel.cpp.

Referenced by NEDequantizationLayerKernel::name().

366  : _input(nullptr), _output(nullptr)
367 {
368 }

◆ NEDequantizationLayerKernel() [2/3]

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

◆ NEDequantizationLayerKernel() [3/3]

Default Move Constructor.

◆ ~NEDequantizationLayerKernel()

Default destructor.

Referenced by NEDequantizationLayerKernel::name().

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output 
)

Set input, output tensors.

Parameters
[in]inputSource tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL/QSYMM8/QSYMM16.
[out]outputDestination tensor with the same dimensions of input. Data type supported: F16/F32.

Definition at line 370 of file NEDequantizationLayerKernel.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ITensor::info(), arm_compute::test::validation::input, and arm_compute::validate_arguments().

Referenced by NEDequantizationLayerKernel::name().

371 {
373  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info()));
374 
375  _input = input;
376  _output = output;
377 
378  // Configure kernel window
379  auto win_config = validate_and_configure_window(input->info(), output->info());
380 
381  ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
382 
383  INEKernel::configure(std::get<1>(win_config));
384 }
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ name()

◆ operator=() [1/2]

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

Referenced by NEDequantizationLayerKernel::name().

◆ operator=() [2/2]

Default move assignment operator.

◆ 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 393 of file NEDequantizationLayerKernel.cpp.

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, ITensorInfo::data_type(), arm_compute::F16, arm_compute::F32, ITensor::info(), and IKernel::window().

Referenced by NEDequantizationLayerKernel::name().

394 {
398 
399  switch(_output->info()->data_type())
400  {
401  case DataType::F32:
402  run_dequantization_core<float>(_input, _output, window);
403  break;
404 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
405  case DataType::F16:
406  run_dequantization_core<float16_t>(_input, _output, window);
407  break;
408 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
409  default:
410  ARM_COMPUTE_ERROR("Unsupported data type.");
411  }
412 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
1 channel, 1 F16 per channel
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:941
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205

◆ validate()

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

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

Parameters
[in]inputInput tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL/QSYMM8/QSYMM16.
[in]outputOutput tensor info. Data types supported: F16/F32.
Returns
a status

Definition at line 386 of file NEDequantizationLayerKernel.cpp.

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), and arm_compute::validate_arguments().

Referenced by NEDequantizationLayerKernel::name(), and NEDequantizationLayer::validate().

387 {
389  ARM_COMPUTE_RETURN_ON_ERROR(std::get<0>(validate_and_configure_window(input->clone().get(), output->clone().get())));
390  return Status{};
391 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)

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