Skip to content

Commit

Permalink
Change new idiom to if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagandhamal committed Oct 4, 2022
1 parent 12c8b87 commit 7c51086
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions torchvision/ops/focal_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def sigmoid_focal_loss(
# Original implementation from https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/focal_loss.py

# Check reduction option
modes = ["none", "mean", "sum"]
if reduction not in modes:
if reduction != "none" or reduction != "mean" or reduction != "sum":
raise ValueError(
f"Invalid Value for arg 'reduction': '{reduction} \n Supported reduction modes: 'none', 'mean', 'sum'"
)
Expand Down

0 comments on commit 7c51086

Please sign in to comment.