aihwkit.inference.noise.fusion module

Fusion chip noise model for inference.

class aihwkit.inference.noise.fusion.FusionImportNoiseModel(programmed_conductances, g_converter=None, **converter_params)[source]

Bases: BaseNoiseModel

Using the Fusion Chip to use realistic and measured PCM noise.

This noise model does not generate noise but instead applies the programmed noise and read values from the Fusion Chip to the weights.

It will be automatically configured with the programmed weights from the Fusion Chip when using:

from aihwkit.utils.export import fusion_import
model = fusion_import(csv_file, model)
Parameters:
  • programmed_conductances (List[Tensor]) – Condactances from the Fusion Chip

  • g_converter (BaseConductanceConverter | None) – g_converter (default FusionConductanceConverter)

  • **converter_params (Any) – parameters used for the conductance conversion

apply_drift_noise(weights, drift_noise_parameters, t_inference)[source]

Apply the stored programming noise from the Fusion Chip to weights.

In principle, additional drift could be applied here, however, currently nothing is implemented and the Fusion Chip programmed weights are simply return.

Parameters:
  • weights (Tensor) – weights tensor that was used to program to the Fusion Chip

  • drift_noise_parameters (List[Tensor | None]) – list of parameters (ignored)

  • t_inference (float) – assumed time of inference (in sec) (ignored)

Returns:

weight tensor with programming noise applied

Raises:

TileError – In case the dimensions of the programmed conductances mismatch

Return type:

Tensor

apply_noise(weights, t_inference)[source]

Apply the expected noise.

Applies the noise to a non-perturbed conductance matrix weights at time of inference t_inference (in seconds) where 0 sec refers to the time when weight programming has finished.

Note

The drift coefficients and intermediate noises etc. are sampled for each application of this function anew from the distributions, thus it samples the expected noise and drift behavior at time t_inference but not a continual trajectory of a given device instance over time (having e.g. constant drift coefficients).

Parameters:
  • weights (Tensor) –

  • t_inference (float) –

Return type:

Tensor

apply_programming_noise(weights)[source]

Simply return the original weights.

Since the programming to the Fusion Chip will also include drift, we set the weight during drift noise to enable drift compensation against the target weight values

Parameters:

weights (Tensor) – Weights to program. Note that this is unused as the programmed_conductances for this weights are simply taken.

Returns:

weight tensor with programming noise applied, and tuple of all drift coefficients (per conductances slice) that are determined during programming.

Return type:

Tuple[Tensor, List[Tensor]]