eleanor.torch.variability#

class eleanor.torch.variability.C2CVar(*args, **kwargs)[source]#

Bases: Module

Cycle to cycle variability for eleanor models Apply a percentage of variability to a parameter of the models on evey call

Parameters:
name#

Name of the variability parameter.

Type:

str

variability#

Percentage of variability.

Type:

float

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\)

set_variability(variability)[source]#

Set the D2D variability percentage.

Parameters:

variability (float) – Variability percentage.

Return type:

None

class eleanor.torch.variability.D2DVar(*args, **kwargs)[source]#

Bases: Module

Device to device variability for eleanor models Apply a percentage of variability to a parameter of the models

Parameters:
name#

Name of the variability parameter.

Type:

str

variability#

Percentage of variability.

Type:

float

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

set_variability(variability)[source]#

Set the D2D variability percentage.

Parameters:

variability (float) – Variability percentage.

Return type:

None

update_variability(shape)[source]#

Update the D2D variability array.

Parameters:
  • mu (torch.Tensor) – Mean value of the parameter to apply the variability.

  • shape (Sequence[int]) – Output shape of the array.

Return type:

None

eleanor.torch.variability.set_d2d_variability(model, variability)[source]#

Set a new variability value to all the D2D objects of a model

Parameters:
  • model (PyTrtorch.nn.Moduleee) – Model that contains the D2D objects.

  • variability (float | Sequence[float]) – New variability value/s.

Return type:

None

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

Parameters:
  • model (PyTrtorch.nn.Moduleee) – Model that contains the D2D objects.

  • name (str) – Name of the D2D parameter.

  • variability (float | Sequence[float]) – New variability value/s.

Return type:

None

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