kaira.losses.image.TotalVariationLoss

Inheritance diagram for TotalVariationLoss
- class kaira.losses.image.TotalVariationLoss[source]
Bases:
BaseLossTotal Variation Loss Module.
This module calculates the total variation loss to encourage spatial smoothness. Total variation regularization reduces noise while preserving edges in images [Rudin et al., 1992] [Mahendran and Vedaldi, 2015].
Methods
Initialize the TotalVariationLoss module.
Forward pass through the TotalVariationLoss module.
- forward(x: Tensor) Tensor[source]
Forward pass through the TotalVariationLoss module.
- Parameters:
x (torch.Tensor) – The input tensor of shape (B, C, H, W).
- Returns:
The total variation loss of the input.
- Return type: