Skip to content

Commit 1409c00

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Fix focal loss tests (#8920)
Reviewed By: scotts Differential Revision: D77997054 fbshipit-source-id: 3cce1f11e550053db5411f531628adffa7b54395
1 parent f3baeff commit 1409c00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/ops/focal_loss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def sigmoid_focal_loss(
3333
"""
3434
# Original implementation from https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/focal_loss.py
3535

36-
if not (0 <= alpha <= 1) or alpha != -1:
36+
if not (0 <= alpha <= 1) and alpha != -1:
3737
raise ValueError(f"Invalid alpha value: {alpha}. alpha must be in the range [0,1] or -1 for ignore.")
3838

3939
if not torch.jit.is_scripting() and not torch.jit.is_tracing():

0 commit comments

Comments
 (0)