aihwkit.nn.low_precision_modules.quantization_states module

Functions to manipulate the quantization state of a module

aihwkit.nn.low_precision_modules.quantization_states.enable_quant_states(model)[source]

Function to enable the quantization states in all modules that inherit from the QuantizedModule class.

Parameters:

model (Module) – Model to configure

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.estimate_act_ranges(model)[source]

Places the activation quantizers of a model in estimate_ranges mode

Parameters:

model (Module) – Model to place the activation quantizers of its modules in estimate_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.estimate_ranges(model)[source]

Places the quantizers of a model in estimate_ranges mode

Parameters:

model (Module) – Model to place the quantizers of its modules in estimate_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.estimate_ranges_train(model)[source]

Places the quantizers of a model in estimate_ranges_train mode

Parameters:

model (Module) – Model to place the quantizers of its modules in estimate_ranges_train mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.fix_act_ranges(model)[source]

Places the activation quantizers of a model in fix_ranges mode

Parameters:

model (Module) – Model to place the activation quantizers of its modules in fix_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.fix_ranges(model)[source]

Places the quantizers of a model in fix_ranges mode

Parameters:

model (Module) – Model to place the quantizers of its modules in fix_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.fix_weight_ranges(model)[source]

Places the weight quantizers of a model in fix_ranges mode

Parameters:

model (Module) – Model to place the weight quantizers of its modules in fix_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.full_precision(model)[source]

Places the activations and weights in full precision.

Parameters:

model (Module) – Model to place the activations and weights of its modules in full precision

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.full_precision_acts(model)[source]

Places the activations in full precision.

Parameters:

model (Module) – Model to place the activations of its modules in full precision

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.full_precision_weights(model)[source]

Places the weights in full precision.

Parameters:

model (Module) – Model to place the weight of its modules in full precision

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.learn_ranges(model)[source]

Places the quantizers of a model in learn_ranges mode

Parameters:

model (Module) – Model to place the quantizers of its modules in learn_ranges mode

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.quantized(model)[source]

Enables quantization on both weights and activations.

Parameters:

model (Module) – Model to enable activation and weight quantization recursively on its modules.

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.quantized_acts(model)[source]

Enables quantization of the activations.

Parameters:

model (Module) – Model to enable activation quantization recursively on its modules.

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.quantized_weights(model)[source]

Enables quantization of the weights.

Parameters:

model (Module) – Model to enable weight quantization recursively on its modules.

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.reset_act_ranges(model)[source]

Resets the activation ranges of a model to uninitialized

Parameters:

model (Module) – Model to reset the activation quantizers of its modules

Return type:

None

aihwkit.nn.low_precision_modules.quantization_states.set_quant_state(model, weight_quant, act_quant)[source]

Function to configure the activation and weight quantizers of a model. The model can be configured to either have the weights/activations in full precision or the quantization enabled.

Parameters:
  • model (Module) – Model to configure

  • weight_quant (bool) – If True, enable weight quantization for all modules in the model. If False, keep the weights in full precision.

  • act_quant (bool) – If True, enable activation quantization for all modules in the model. If False, keep the activations in full precision.

Return type:

None