MLIR 22.0.0git
mlir::quant::UniformQuantizedValueConverter Class Reference

Reference implementation of converting between real numbers and values represented by a UniformQuantizedType. More...

#include "mlir/Dialect/Quant/Utils/UniformSupport.h"

Public Member Functions

 UniformQuantizedValueConverter (UniformQuantizedType uniformType)
 UniformQuantizedValueConverter (double scale, double zeroPoint, double clampMin, double clampMax, uint32_t storageBitWidth, bool isSigned)
 UniformQuantizedValueConverter (double scale, double zeroPoint, const APFloat &clampMin, const APFloat &clampMax, uint32_t storageBitWidth, bool isSigned)
virtual APInt quantizeFloatToInt (APFloat expressedValue) const
int64_t quantizeFloatToInt64 (APFloat expressedValue) const
virtual ~UniformQuantizedValueConverter ()=default

Detailed Description

Reference implementation of converting between real numbers and values represented by a UniformQuantizedType.

Note that this is not expected to be speedy and may be superseded eventually by a more optimal implementation. Also, the interface assumes that quantization is done per-layer and will need to be wider for various per-channel schemes. As such, this is a placeholder.

Definition at line 61 of file UniformSupport.h.

Constructor & Destructor Documentation

◆ UniformQuantizedValueConverter() [1/3]

mlir::quant::UniformQuantizedValueConverter::UniformQuantizedValueConverter ( UniformQuantizedType uniformType)
inlineexplicit

Definition at line 63 of file UniformSupport.h.

References getZeroPoint(), and UniformQuantizedValueConverter().

Referenced by UniformQuantizedValueConverter().

◆ UniformQuantizedValueConverter() [2/3]

mlir::quant::UniformQuantizedValueConverter::UniformQuantizedValueConverter ( double scale,
double zeroPoint,
double clampMin,
double clampMax,
uint32_t storageBitWidth,
bool isSigned )
inline

Definition at line 74 of file UniformSupport.h.

◆ UniformQuantizedValueConverter() [3/3]

mlir::quant::UniformQuantizedValueConverter::UniformQuantizedValueConverter ( double scale,
double zeroPoint,
const APFloat & clampMin,
const APFloat & clampMax,
uint32_t storageBitWidth,
bool isSigned )
inline

Definition at line 83 of file UniformSupport.h.

◆ ~UniformQuantizedValueConverter()

virtual mlir::quant::UniformQuantizedValueConverter::~UniformQuantizedValueConverter ( )
virtualdefault

Member Function Documentation

◆ quantizeFloatToInt()

virtual APInt mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt ( APFloat expressedValue) const
inlinevirtual

Definition at line 94 of file UniformSupport.h.

References result.

Referenced by quantizeFloatToInt64().

◆ quantizeFloatToInt64()

int64_t mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt64 ( APFloat expressedValue) const
inline

Definition at line 121 of file UniformSupport.h.

References quantizeFloatToInt().


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