kaira.losses.image.GradientLoss

Inheritance diagram of GradientLoss

Inheritance diagram for GradientLoss

class kaira.losses.image.GradientLoss[source]

Bases: BaseLoss

Gradient 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

__init__

Initialize the GradientLoss module.

forward

Forward pass through the GradientLoss module.

__init__()[source]

Initialize the GradientLoss module.

forward(x: Tensor, target: Tensor) Tensor[source]

Forward pass through the GradientLoss module.

Parameters:
Returns:

The gradient loss between the input and the target.

Return type:

torch.Tensor