aihwkit.simulator.digital_low_precision.base_quantized_classes module
- class aihwkit.simulator.digital_low_precision.base_quantized_classes.FP32Acts(*args, **kwargs)[source]
Bases:
Module- Parameters:
args (Any)
kwargs (Any)
- 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.
- class aihwkit.simulator.digital_low_precision.base_quantized_classes.QuantizedActivation(*args, **kwargs)[source]
Bases:
QuantizedModule- 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.
- class aihwkit.simulator.digital_low_precision.base_quantized_classes.QuantizedModule(*args, method=QMethods.asymmetric_uniform, act_method=None, n_bits=8, n_bits_act=None, per_channel_weights=False, per_channel_acts=False, percentile=None, weight_range_method=RangeEstimators.current_minmax, weight_range_options=None, act_range_method=RangeEstimators.running_minmax, act_range_options=None, scale_domain='linear', **kwargs)[source]
Bases:
ModuleParent class for a quantized module. It adds the basic functionality of switching the module between quantized and full precision mode. It also defines the cached parameters and handles the reset of the cache properly.
- property caching
- 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.
- train(mode=True)[source]
Set the module in training mode.
This has an effect only on certain modules. See the documentation of particular modules for details of their behaviors in training/evaluation mode, i.e., whether they are affected, e.g.
Dropout,BatchNorm, etc.- Parameters:
mode (bool) – whether to set training mode (
True) or evaluation mode (False). Default:True.- Returns:
self
- Return type:
Module