analogvnn.nn.noise.PoissonNoise#

Module Contents#

Classes#

PoissonNoise

Implements the Poisson noise function.

class analogvnn.nn.noise.PoissonNoise.PoissonNoise(scale: Optional[float] = None, max_leakage: Optional[float] = None, precision: Optional[int] = None)[source]#

Bases: analogvnn.nn.noise.Noise.Noise, analogvnn.backward.BackwardIdentity.BackwardIdentity

Implements the Poisson noise function.

Variables:
  • scale (nn.Parameter) – the scale of the Poisson noise function.

  • max_leakage (nn.Parameter) – the maximum leakage of the Poisson noise.

  • precision (nn.Parameter) – the precision of the Poisson noise.

property leakage: float[source]#

The leakage of the Poisson noise.

Returns:

the leakage of the Poisson noise.

Return type:

float

property rate_factor: torch.Tensor[source]#

The rate factor of the Poisson noise.

Returns:

the rate factor of the Poisson noise.

Return type:

Tensor

__constants__ = ['scale', 'max_leakage', 'precision'][source]#
scale: torch.nn.Parameter[source]#
max_leakage: torch.nn.Parameter[source]#
precision: torch.nn.Parameter[source]#
static calc_scale(max_leakage: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE, max_check=10000) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Calculates the scale using the maximum leakage and the precision.

Parameters:
  • max_leakage (TENSOR_OPERABLE) – the maximum leakage of the Poisson noise.

  • precision (TENSOR_OPERABLE) – the precision of the Poisson noise.

  • max_check (int) – the maximum value to check for the scale.

Returns:

the scale of the Poisson noise function.

Return type:

TENSOR_OPERABLE

static calc_precision(scale: analogvnn.utils.common_types.TENSOR_OPERABLE, max_leakage: analogvnn.utils.common_types.TENSOR_OPERABLE, max_check=2**16) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Calculates the precision using the scale and the maximum leakage.

Parameters:
  • scale (TENSOR_OPERABLE) – the scale of the Poisson noise function.

  • max_leakage (TENSOR_OPERABLE) – the maximum leakage of the Poisson noise.

  • max_check (int) – the maximum value to check for the precision.

Returns:

the precision of the Poisson noise.

Return type:

TENSOR_OPERABLE

static calc_max_leakage(scale: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Calculates the maximum leakage using the scale and the precision.

Parameters:
  • scale (TENSOR_OPERABLE) – the scale of the Poisson noise function.

  • precision (TENSOR_OPERABLE) – the precision of the Poisson noise.

Returns:

the maximum leakage of the Poisson noise.

Return type:

TENSOR_OPERABLE

static static_cdf(x: analogvnn.utils.common_types.TENSOR_OPERABLE, rate: analogvnn.utils.common_types.TENSOR_OPERABLE, scale_factor: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Calculates the cumulative distribution function of the Poisson noise.

Parameters:
  • x (TENSOR_OPERABLE) – the input of the Poisson noise.

  • rate (TENSOR_OPERABLE) – the rate of the Poisson noise.

  • scale_factor (TENSOR_OPERABLE) – the scale factor of the Poisson noise.

Returns:

the cumulative distribution function of the Poisson noise.

Return type:

TENSOR_OPERABLE

static staticmethod_leakage(scale: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE[source]#

Calculates the leakage of the Poisson noise using the scale and the precision.

Parameters:
  • scale (TENSOR_OPERABLE) – the scale of the Poisson noise function.

  • precision (TENSOR_OPERABLE) – the precision of the Poisson noise.

Returns:

the leakage of the Poisson noise.

Return type:

TENSOR_OPERABLE

pdf(x: torch.Tensor, rate: torch.Tensor) torch.Tensor[source]#

Calculates the probability density function of the Poisson noise.

Parameters:
  • x (Tensor) – the input of the Poisson noise.

  • rate (Tensor) – the rate of the Poisson noise.

Returns:

the probability density function of the Poisson noise.

Return type:

Tensor

log_prob(x: torch.Tensor, rate: torch.Tensor) torch.Tensor[source]#

Calculates the log probability of the Poisson noise.

Parameters:
  • x (Tensor) – the input of the Poisson noise.

  • rate (Tensor) – the rate of the Poisson noise.

Returns:

the log probability of the Poisson noise.

Return type:

Tensor

cdf(x: torch.Tensor, rate: torch.Tensor) torch.Tensor[source]#

Calculates the cumulative distribution function of the Poisson noise.

Parameters:
  • x (Tensor) – the input of the Poisson noise.

  • rate (Tensor) – the rate of the Poisson noise.

Returns:

the cumulative distribution function of the Poisson noise.

Return type:

Tensor

forward(x: torch.Tensor) torch.Tensor[source]#

Adds the Poisson noise to the input.

Parameters:

x (Tensor) – the input of the Poisson noise.

Returns:

the output of the Poisson noise.

Return type:

Tensor

extra_repr() str[source]#

Returns the extra representation of the Poisson noise.

Returns:

the extra representation of the Poisson noise.

Return type:

str