aihwkit.simulator.digital_low_precision.quantization_manager module
- class aihwkit.simulator.digital_low_precision.quantization_manager.Qstates(*values)[source]
Bases:
Enum- estimate_ranges = 0
- estimate_ranges_train = 3
- fix_ranges = 1
- learn_ranges = 2
- class aihwkit.simulator.digital_low_precision.quantization_manager.QuantizationManager(qmethod=QMethods.symmetric_uniform, init=RangeEstimators.current_minmax, per_channel=False, axis=None, n_groups=None, x_min=None, x_max=None, qparams=None, init_params=None)[source]
Bases:
ModuleImplementation of Quantization and Quantization Range Estimation
- Parameters:
n_bits (int) – Number of bits for the quantization.
qmethod (QMethods member (Enum)) – The quantization scheme to use, e.g. symmetric_uniform, asymmetric_uniform, qmn_uniform etc.
init (RangeEstimators member (Enum)) – Initialization method for the grid from
per_channel (bool) – If true, will use a separate quantization grid for each kernel/channle.
x_min (float or PyTorch Tensor) – The minimum value which needs to be represented.
x_max (float or PyTorch Tensor) – The maximum value which needs to be represented.
- extra_repr()[source]
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- property n_bits
- quantizer: QuantizerBase