aihwkit.inference.noise.base module¶
Base class for the phenomenological noise models for inference.
- class aihwkit.inference.noise.base.BaseNoiseModel(g_converter=None)[source]¶
Bases:
object
Base class for phenomenological noise models for inference.
- Parameters
g_converter (aihwkit.inference.converter.base.BaseConductanceConverter) –
- apply_drift_noise(weights, nu_drift_list, t_inference)[source]¶
Apply the expected drift noise to weights.
Uses the
apply_drift_noise_to_conductances()
on each of the conductance slices.- Parameters
weights (torch.Tensor) – weights tensor (usually with programming noise already applied)
nu_drift_list (List[torch.Tensor]) – list of drift nu for each conductance slice
t_inference (float) – assumed time of inference (in sec)
- Returns
weight tensor with drift noise applied
- Return type
torch.Tensor
- apply_drift_noise_to_conductance(g_prog, nu_drift, t_inference)[source]¶
Apply the noise and drift up to the assumed inference time point.
- Parameters
g_prog (torch.Tensor) – Tensor of conductance values after programming (in \(\muS\))
nu_drift (torch.Tensor) – drift nu
t_inference (float) – assumed time of inference (in sec)
- Returns
conductance Tensor with applied noise and drift
- Return type
torch.Tensor
- apply_noise(weights, t_inference)[source]¶
Apply the expected noise.
Applies the noise to a non-perturbed conductance matrix
weights
at time of inferencet_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 (torch.Tensor) –
t_inference (float) –
- Return type
torch.Tensor
- apply_programming_noise(weights)[source]¶
Apply the expected programming noise to weights.
Uses the
apply_programming_noise_to_conductances()
on each of the conductance slices.- Parameters
weights (torch.Tensor) – weights tensor
- Returns
weight tensor with programming noise applied, and tuple of all drift coefficients (per conductances slice) that are determined during programming.
- Return type
Tuple[torch.Tensor, List[torch.Tensor]]