kaira.losses.image.GradientLoss

Inheritance diagram for GradientLoss
- class kaira.losses.image.GradientLoss[source]
Bases:
BaseLossGradient Loss Module.
This module calculates the gradient loss to preserve edge information. Gradient loss explicitly penalizes differences in image gradients, helping to preserve structural information and edges [Mathieu et al., 2016].
Methods
Initialize the GradientLoss module.
Forward pass through the GradientLoss module.
- forward(x: Tensor, target: Tensor) Tensor[source]
Forward pass through the GradientLoss module.
- Parameters:
x (torch.Tensor) – The input tensor.
target (torch.Tensor) – The target tensor.
- Returns:
The gradient loss between the input and the target.
- Return type: