We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b5c7443 commit f709766Copy full SHA for f709766
torchvision/ops/focal_loss.py
@@ -33,7 +33,7 @@ def sigmoid_focal_loss(
33
"""
34
# Original implementation from https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/focal_loss.py
35
36
- if not (0 <= alpha <= 1) or alpha != -1:
+ if not (0 <= alpha <= 1) and alpha != -1:
37
raise ValueError(f"Invalid alpha value: {alpha}. alpha must be in the range [0,1] or -1 for ignore.")
38
39
if not torch.jit.is_scripting() and not torch.jit.is_tracing():
0 commit comments