Skip to content

Commit 7c51086

Browse files
Change new idiom to if/else
1 parent 12c8b87 commit 7c51086

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

torchvision/ops/focal_loss.py

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

3636
# Check reduction option
37-
modes = ["none", "mean", "sum"]
38-
if reduction not in modes:
37+
if reduction != "none" or reduction != "mean" or reduction != "sum":
3938
raise ValueError(
4039
f"Invalid Value for arg 'reduction': '{reduction} \n Supported reduction modes: 'none', 'mean', 'sum'"
4140
)

0 commit comments

Comments
 (0)