Base Dual Loss#

Module for the BaseDualLoss class.

class BaseDualLoss(reduction='mean')[source]#

Bases: DualLossInterface

Base class for all losses requiring both an input and a target tensor, implementing common functionality.

All specific loss types should inherit from this class and implement its abstract methods.

This class is not meant to be instantiated directly.

Initialization of the BaseDualLoss class.

Parameters:

reduction (str) – The reduction method to aggregate pointwise loss values. Available options include: "none" for unreduced loss, "mean" for the average of the loss values, and "sum" for their total sum. Default is "mean".

Raises:

ValueError – If the specified reduction method is not among the available options.