Shortcuts

mmedit.models.losses.gradient_loss

Module Contents

Classes

GradientLoss

Gradient loss.

Attributes

_reduction_modes

mmedit.models.losses.gradient_loss._reduction_modes = ['none', 'mean', 'sum'][source]
class mmedit.models.losses.gradient_loss.GradientLoss(loss_weight: float = 1.0, reduction: str = 'mean')[source]

Bases: torch.nn.Module

Gradient loss.

Parameters
  • loss_weight (float) – Loss weight for L1 loss. Default: 1.0.

  • reduction (str) – Specifies the reduction to apply to the output. Supported choices are ‘none’ | ‘mean’ | ‘sum’. Default: ‘mean’.

forward(pred: torch.Tensor, target: torch.Tensor, weight: Optional[torch.Tensor] = None) torch.Tensor[source]
Parameters
  • pred (Tensor) – of shape (N, C, H, W). Predicted tensor.

  • target (Tensor) – of shape (N, C, H, W). Ground truth tensor.

  • weight (Tensor, optional) – of shape (N, C, H, W). Element-wise weights. Default: None.

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.