toad.nn.functional module

toad.nn.functional.flooding(loss, b)[source]

flooding loss

toad.nn.functional.focal_loss(input, target, alpha=1.0, gamma=2.0, reduction='mean')[source]

focal loss

Parameters
  • input (Tensor) – N x C, C is the number of classes

  • target (Tensor) – N, each value is the index of classes

  • alpha (Variable) – balaced variant of focal loss, range is in [0, 1]

  • gamma (float) – focal loss parameter

  • reduction (str) – mean, sum, none for reduce the loss of each classes

toad.nn.functional.binary_focal_loss(input, target, **kwargs)[source]

binary focal loss

toad.nn.functional.focal_loss_for_numpy(input, target, alpha=1.0, gamma=2.0, reduction='mean')[source]

focal loss for numpy array

toad.nn.functional.label_smoothing(labels, smoothing=0.1)[source]

label smoothing