analogvnn.nn.noise.UniformNoise
#
Module Contents#
Classes#
Implements the uniform noise function. |
- class analogvnn.nn.noise.UniformNoise.UniformNoise(low: Optional[float] = None, high: Optional[float] = None, leakage: Optional[float] = None, precision: Optional[int] = None)[source]#
Bases:
analogvnn.nn.noise.Noise.Noise
,analogvnn.backward.BackwardIdentity.BackwardIdentity
Implements the uniform noise function.
- Variables:
low (nn.Parameter) – the lower bound of the uniform noise.
high (nn.Parameter) – the upper bound of the uniform noise.
leakage (nn.Parameter) – the leakage of the uniform noise.
precision (nn.Parameter) – the precision of the uniform noise.
- property mean: torch.Tensor[source]#
The mean of the uniform noise.
- Returns:
the mean of the uniform noise.
- Return type:
Tensor
- property stddev: torch.Tensor[source]#
The standard deviation of the uniform noise.
- Returns:
the standard deviation of the uniform noise.
- Return type:
Tensor
- property variance: torch.Tensor[source]#
The variance of the uniform noise.
- Returns:
the variance of the uniform noise.
- Return type:
Tensor
- static calc_high_low(leakage: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) Tuple[analogvnn.utils.common_types.TENSOR_OPERABLE, analogvnn.utils.common_types.TENSOR_OPERABLE] [source]#
Calculate the high and low from leakage and precision.
- Parameters:
leakage (TENSOR_OPERABLE) – the leakage of the uniform noise.
precision (TENSOR_OPERABLE) – the precision of the uniform noise.
- Returns:
the high and low of the uniform noise.
- Return type:
Tuple[TENSOR_OPERABLE, TENSOR_OPERABLE]
- static calc_leakage(low: analogvnn.utils.common_types.TENSOR_OPERABLE, high: analogvnn.utils.common_types.TENSOR_OPERABLE, precision: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the leakage from low, high and precision.
- Parameters:
low (TENSOR_OPERABLE) – the lower bound of the uniform noise.
high (TENSOR_OPERABLE) – the upper bound of the uniform noise.
precision (TENSOR_OPERABLE) – the precision of the uniform noise.
- Returns:
the leakage of the uniform noise.
- Return type:
TENSOR_OPERABLE
- static calc_precision(low: analogvnn.utils.common_types.TENSOR_OPERABLE, high: analogvnn.utils.common_types.TENSOR_OPERABLE, leakage: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
Calculate the precision from low, high and leakage.
- Parameters:
low (TENSOR_OPERABLE) – the lower bound of the uniform noise.
high (TENSOR_OPERABLE) – the upper bound of the uniform noise.
leakage (TENSOR_OPERABLE) – the leakage of the uniform noise.
- Returns:
the precision of the uniform noise.
- Return type:
TENSOR_OPERABLE
- pdf(x: torch.Tensor) torch.Tensor [source]#
The probability density function of the uniform noise.
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the probability density function of the uniform noise.
- Return type:
Tensor
- log_prob(x: torch.Tensor) torch.Tensor [source]#
The log probability density function of the uniform noise.
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the log probability density function of the uniform noise.
- Return type:
Tensor
- cdf(x: analogvnn.utils.common_types.TENSOR_OPERABLE) analogvnn.utils.common_types.TENSOR_OPERABLE [source]#
The cumulative distribution function of the uniform noise.
- Parameters:
x (TENSOR_OPERABLE) – the input tensor.
- Returns:
the cumulative distribution function of the uniform noise.
- Return type:
TENSOR_OPERABLE
- forward(x: torch.Tensor) torch.Tensor [source]#
Add the uniform noise to the input tensor.
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the output tensor.
- Return type:
Tensor