aihwkit.inference.utils module
Utilities for inference.
- aihwkit.inference.utils.drift_analog_weights(model, t_inference=0.0)[source]
(Program) and drift all analog inference layers of a given model.
- Parameters:
model (Module) – torch model with analog layers
t_inference (float) – assumed time of inference (in sec)
- Raises:
ModuleError – if the layer is not in evaluation mode.
- Return type:
None
- aihwkit.inference.utils.program_analog_weights(model, noise_model)[source]
Program all analog inference layers of a given model.
- Parameters:
model (Module) – torch model with analog layers
noise_model (BaseNoiseModel | None) –
Optional defining the noise model to be used. If not given, it will use the noise model defined in the RPUConfig.
Caution
If given a noise model here it will overwrite the stored rpu_config.noise_model definition in the tiles.
- Raises:
ModuleError – if the layer is not in evaluation mode.
- Return type:
None