analogvnn.nn.noise.GaussianNoise
#
Module Contents#
Classes#
Implements the Gaussian noise function. |
- class analogvnn.nn.noise.GaussianNoise.GaussianNoise(std: Optional[float] = None, leakage: Optional[float] = None, precision: Optional[int] = None)[source]#
Bases:
analogvnn.nn.noise.Noise.Noise
,analogvnn.backward.BackwardIdentity.BackwardIdentity
Implements the Gaussian noise function.
- Variables:
std (nn.Parameter) – the standard deviation of the Gaussian noise.
leakage (nn.Parameter) – the leakage of the Gaussian noise.
precision (nn.Parameter) – the precision of the Gaussian noise.
- property stddev: torch.Tensor[source]#
The standard deviation of the Gaussian noise.
- Returns:
the standard deviation of the Gaussian noise.
- Return type:
Tensor
- property variance: torch.Tensor[source]#
The variance of the Gaussian noise.
- Returns:
the variance of the Gaussian noise.
- Return type:
Tensor
- static calc_std(leakage: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the standard deviation of the Gaussian noise.
- static calc_precision(std: analogvnn.utils.common_types.TENSOR_OPERABLE, leakage: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the precision of the Gaussian noise.
- static calc_leakage(std: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the leakage of the Gaussian noise.
- pdf(x: torch.Tensor, mean: torch.Tensor = 0) torch.Tensor [source]#
Calculate the probability density function of the Gaussian noise.
- Parameters:
x (Tensor) – the input tensor.
mean (Tensor) – the mean of the Gaussian noise.
- Returns:
the probability density function of the Gaussian noise.
- Return type:
Tensor
- log_prob(x: torch.Tensor, mean: torch.Tensor = 0) torch.Tensor [source]#
Calculate the log probability density function of the Gaussian noise.
- Parameters:
x (Tensor) – the input tensor.
mean (Tensor) – the mean of the Gaussian noise.
- Returns:
the log probability density function of the Gaussian noise.
- Return type:
Tensor
- static static_cdf(x: analogvnn.utils.common_types.TENSOR_OPERABLE, std: analogvnn.utils.common_types.TENSOR_OPERABLE, mean: analogvnn.utils.common_types.TENSOR_OPERABLE = 0.0) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the cumulative distribution function of the Gaussian noise.
- Parameters:
x (TENSOR_OPERABLE) – the input tensor.
std (TENSOR_OPERABLE) – the standard deviation of the Gaussian noise.
mean (TENSOR_OPERABLE) – the mean of the Gaussian noise.
- Returns:
the cumulative distribution function of the Gaussian noise.
- Return type:
TENSOR_OPERABLE
- cdf(x: torch.Tensor, mean: torch.Tensor = 0) torch.Tensor [source]#
Calculate the cumulative distribution function of the Gaussian noise.
- Parameters:
x (Tensor) – the input tensor.
mean (Tensor) – the mean of the Gaussian noise.
- Returns:
the cumulative distribution function of the Gaussian noise.
- Return type:
Tensor
- forward(x: torch.Tensor) torch.Tensor [source]#
Add the Gaussian noise to the input tensor.
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the output tensor.
- Return type:
Tensor