toad.nn.functional module¶
- 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