skshapes.loss.baseloss.ProductLoss

class skshapes.loss.baseloss.ProductLoss(loss=None, scalar=1.0)

Bases: BaseLoss

Abstract class for losses which are the product of a loss and a scalar.

This class can be directly instantiated, but it is more convenient to use the * operator to multiply a loss by a scalar, which returns a ProductLoss object.

__init__(loss=None, scalar=1.0)

Class constructor.

It saves the loss and the scalar as attributes of the class.

Parameters:
  • loss (BaseLoss | None) – loss function to be multiplied by the scalar

  • scalar (int | float) – scalar to multiply the loss by

Methods

__init__([loss, scalar])

Class constructor.