Skip to content

Commit f3af22a

Browse files
committed
minor fixes
Signed-off-by: ytl0623 <[email protected]>
1 parent c793454 commit f3af22a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

monai/losses/unified_focal_loss.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ def forward(self, y_pred: torch.Tensor, y_true: torch.Tensor) -> torch.Tensor:
7979
if y_true.shape != y_pred.shape:
8080
raise ValueError(f"ground truth has different shape ({y_true.shape}) from input ({y_pred.shape})")
8181

82-
# clip the prediction to avoid NaN
83-
y_pred = torch.clamp(y_pred, self.epsilon, 1.0 - self.epsilon)
8482
axis = list(range(2, len(y_pred.shape)))
8583

8684
# Calculate true positives (tp), false negatives (fn) and false positives (fp)
@@ -117,6 +115,7 @@ class AsymmetricFocalLoss(_Loss):
117115
Michael Yeung, Computerized Medical Imaging and Graphics
118116
"""
119117

118+
120119
def __init__(
121120
self,
122121
to_onehot_y: bool = False,

0 commit comments

Comments
 (0)