(input_values, gamma)
return loss.mean()
Computes the focal loss
Computes the focal loss
Computes the focal loss
def focal_loss(input_values, gamma):
    """Computes the focal loss"""
    p = torch.exp(-input_values)
    loss = (1 - p) ** gamma * input_values
    return loss.mean()
def focal_loss ( input_values , gamma ) : p = torch . exp ( - input_values ) loss = ( 1 - p ) ** gamma * input_values return loss . mean ( )