eleanor.torch.variability#
- class eleanor.torch.variability.C2CVar(*args, **kwargs)[source]#
Bases:
ModuleCycle to cycle variability for eleanor models Apply a percentage of variability to a parameter of the models on evey call
Example
>>> param_var = C2CVar("param", 0.1) >>> param_with_variability = param_var(param)
- __call__(mu, shape)[source]#
Apply C2C variability into the input parameter.
- Parameters:
mu (torch.Tensor) – Mean value of the parameter to apply the variability.
shape (StateShape) – Output shape of the array.
key (PRNGKey) – Key to generate random variability
- Return type:
Array with coefficient of variation \(\text{variability} = \sigma/\mu\)
- class eleanor.torch.variability.D2DVar(*args, **kwargs)[source]#
Bases:
ModuleDevice to device variability for eleanor models Apply a percentage of variability to a parameter of the models
Example
>>> param_var = D2DVar("param", 0.1) >>> param_with_variability = param_var(param, (10,))
- __call__(mu, shape)[source]#
Apply D2D variability into the input parameter.
- Parameters:
mu (torch.Tensor) – Mean value of the parameter to apply the variability.
shape (Sequence[int]) – Output shape of the array.
- Returns:
torch.Tensor with coefficient of variation
\(\text{variability} = \sigma/\mu\)
- Return type:
torch.Tensor
- eleanor.torch.variability.set_d2d_variability(model, variability)[source]#
Set a new variability value to all the D2D objects of a model
- eleanor.torch.variability.set_d2d_variability_name(model, name, variability)[source]#
Set a new variability value to all the D2D objects of a model with a given name
- eleanor.torch.variability.update_d2d_variability(model, shape)[source]#
Update the device to device variability of all the D2DVar parameters with a new key.
- Parameters:
model (PyTrtorch.nn.Moduleee) – Model with the parameters that want to update the D2D.
shape (Sequence[int]) – Shape of the variability array.
- Return type:
None
- eleanor.torch.variability.update_d2d_variability_name(model, name, shape)[source]#
Update the device to device variability of all the D2DVar parameters with the same name..
- Parameters:
model (PyTrtorch.nn.Moduleee) – Model with the parameters that want to update the D2D.
name (Array) – Name of the parameter to update.
shape (Sequence[int]) – Shape of the variability array.
- Return type:
None