MLIR  16.0.0git
Namespaces | Classes | Functions
mlir::quant Namespace Reference

Namespaces

 detail
 
 QuantizationFlags
 Enumeration of bit-mapped flags related to quantized types.
 

Classes

class  AnyQuantizedType
 A quantized type that maps storage to/from expressed types in an unspecified way. More...
 
class  CalibratedQuantizedType
 A quantized type that infers its range from given min/max values. More...
 
struct  ExpressedToQuantizedConverter
 Performs type conversion from an arbitrary input type to a type that is expressed by a QuantizedType. More...
 
class  QuantizedType
 Base class for all quantized types known to this dialect. More...
 
class  UniformQuantizedPerAxisType
 Represents per-axis (also known as per-channel quantization). More...
 
class  UniformQuantizedPerAxisValueConverter
 An utility class to quantize an attribute by the per-axis quantization parameters. More...
 
class  UniformQuantizedType
 Represents a family of uniform, quantized types. More...
 
class  UniformQuantizedValueConverter
 Reference implementation of converting between real numbers and values represented by a UniformQuantizedType. More...
 

Functions

UniformQuantizedType fakeQuantAttrsToType (Location loc, unsigned numBits, double rmin, double rmax, bool narrowRange, Type expressedType, bool isSigned=false)
 Converts per-layer FakeQuant attributes to the corresponding type. More...
 
UniformQuantizedPerAxisType fakeQuantAttrsToType (Location loc, unsigned numBits, int32_t quantizedDimension, ArrayRef< double > rmins, ArrayRef< double > rmax, bool narrowRange, Type expressedType, bool isSigned=false)
 Converts per-channel FakeQuant attributes to the corresponding type. More...
 

Function Documentation

◆ fakeQuantAttrsToType() [1/2]

UniformQuantizedType mlir::quant::fakeQuantAttrsToType ( Location  loc,
unsigned  numBits,
double  rmin,
double  rmax,
bool  narrowRange,
Type  expressedType,
bool  isSigned = false 
)

Converts per-layer FakeQuant attributes to the corresponding type.

In the event that the parameters cannot be converted, returns a nullptr convertible Type and issues an appropriate error. Note that there are multiple variants of a per-layer FakeQuant op, so this function takes the attributes discretely vs taking a reference to the originating op.

Definition at line 108 of file FakeQuantSupport.cpp.

References mlir::emitError(), mlir::quant::UniformQuantizedType::getChecked(), mlir::Type::getContext(), getDefaultStorageParams(), getNudgedScaleAndZeroPoint(), and mlir::quant::QuantizationFlags::Signed.

Referenced by mlir::tosa::buildQTypeFromMinMax().

◆ fakeQuantAttrsToType() [2/2]

UniformQuantizedPerAxisType mlir::quant::fakeQuantAttrsToType ( Location  loc,
unsigned  numBits,
int32_t  quantizedDimension,
ArrayRef< double >  rmins,
ArrayRef< double >  rmax,
bool  narrowRange,
Type  expressedType,
bool  isSigned = false 
)

Converts per-channel FakeQuant attributes to the corresponding type.

In the event that the parameters cannot be converted, returns a nullptr convertible Type and issues an appropriate error.

Definition at line 139 of file FakeQuantSupport.cpp.

References mlir::emitError(), mlir::quant::UniformQuantizedPerAxisType::getChecked(), mlir::Type::getContext(), getDefaultStorageParams(), getNudgedScaleAndZeroPoint(), and mlir::quant::QuantizationFlags::Signed.