skshapes.loss.baseloss.SumLoss

class skshapes.loss.baseloss.SumLoss(loss1=None, loss2=None)

Bases: BaseLoss

Abstract class for losses which are the sum of two losses.

This class can be directly instantiated, but it is more convenient to use the + operator to add two losses, which returns a SumLoss object.

Note that adding two losses that are not compatible (e.g. a loss for images and a loss for meshes) will not raise an error at the time of the addition. However it will raise an error when the __call__ method is used, thanks to the runtime type checker.

Parameters:
  • loss1 (BaseLoss | None) – First loss to be added.

  • loss2 (BaseLoss | None) – Second loss to be added.

__init__(loss1=None, loss2=None)

Methods

__init__([loss1, loss2])