MLIR
15.0.0git
|
#include "mlir/Dialect/Quant/QuantizeUtils.h"
#include "mlir/Dialect/Quant/UniformSupport.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinTypes.h"
Go to the source code of this file.
Functions | |
static Attribute | convertPrimitiveValueAttr (Attribute origRealValue, QuantizedType quantizedElementType, const UniformQuantizedValueConverter &converter, Type &outConvertedType) |
Converts a possible primitive, real expressed value attribute to a corresponding storage attribute (typically FloatAttr -> IntegerAttr). More... | |
static DenseElementsAttr | convertDenseFPElementsAttr (DenseFPElementsAttr realFPElementsAttr, QuantizedType quantizedElementType, const UniformQuantizedValueConverter &converter) |
Converts a real expressed DenseFPElementsAttr to a corresponding DenseElementsAttr (typically DenseIntElementsAttr) containing quantized storage values assuming the given quantizedElementType and converter. More... | |
static SparseElementsAttr | convertSparseElementsAttr (SparseElementsAttr realSparseAttr, QuantizedType quantizedElementType, const UniformQuantizedValueConverter &converter) |
Converts a real expressed SplatElementsAttr to a corresponding SplatElementsAttr containing quantized storage values assuming the given quantizedElementType and converter. More... | |
|
static |
Converts a real expressed DenseFPElementsAttr to a corresponding DenseElementsAttr (typically DenseIntElementsAttr) containing quantized storage values assuming the given quantizedElementType and converter.
Definition at line 39 of file QuantizeUtils.cpp.
References mlir::DenseFPElementsAttr::begin(), mlir::quant::QuantizedType::castExpressedToStorageType(), mlir::DenseIntElementsAttr::get(), and mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt().
Referenced by convertSparseElementsAttr(), and mlir::quant::quantizeAttrUniform().
|
static |
Converts a possible primitive, real expressed value attribute to a corresponding storage attribute (typically FloatAttr -> IntegerAttr).
quantizedElementType is the QuantizedType that describes the expressed origValue. Returns a converter Attribute or nullptr if conversion is not possible.
Definition at line 22 of file QuantizeUtils.cpp.
References mlir::Attribute::cast(), mlir::quant::QuantizedType::getStorageType(), mlir::Attribute::isa(), and mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt().
Referenced by mlir::quant::quantizeAttrUniform().
|
static |
Converts a real expressed SplatElementsAttr to a corresponding SplatElementsAttr containing quantized storage values assuming the given quantizedElementType and converter.
Definition at line 70 of file QuantizeUtils.cpp.
References mlir::Attribute::cast(), mlir::quant::QuantizedType::castExpressedToStorageType(), convertDenseFPElementsAttr(), mlir::DenseElementsAttr::getValues(), and mlir::Attribute::isa().
Referenced by mlir::quant::quantizeAttrUniform().