Skip to content

std

Functions:

Name Description
log_ratio

Compute the log of the ratio of max scale to the standard deviations.

masked_negative_log_mean

Compute the mean of the elements which remain after masking, instead of including the zeroed out elements.

negative_log_mean

Compute the negative log mean loss. Useful as a regularization function for noise layer parameters.

log_ratio

log_ratio(std: Tensor, max_scale: Tensor) -> torch.Tensor

Compute the log of the ratio of max scale to the standard deviations.

Parameters:

Name Type Description Default

std

Tensor

The standard deviation tensor.

required

max_scale

Tensor

The maximum scale tensor. This is the maximum value that the standard deviation can take. See stainedglass_core.noise_layer.parameterizations.ScaledStandardDeviationParameterization.

required

Returns:

Type Description
torch.Tensor

The log of the ratio of the maximum scale to the standard deviation.

Added in version 0.82.0.

masked_negative_log_mean

masked_negative_log_mean(
    input: Tensor, mask: Tensor
) -> torch.Tensor

Compute the mean of the elements which remain after masking, instead of including the zeroed out elements.

Parameters:

Name Type Description Default

input

Tensor

The input tensor.

required

mask

Tensor

The mask tensor.

required

Returns:

Type Description
torch.Tensor

The negative log mean of unmasked elements.

negative_log_mean

negative_log_mean(input: Tensor) -> torch.Tensor

Compute the negative log mean loss. Useful as a regularization function for noise layer parameters.

Parameters:

Name Type Description Default

input

Tensor

The input tensor.

required

Returns:

Type Description
torch.Tensor

The negative log mean loss.