Skip to content

Commit

Permalink
Modify args description and remove check
Browse files Browse the repository at this point in the history
  • Loading branch information
zifuwanggg committed Nov 30, 2024
1 parent a778e58 commit aeef0af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions monai/losses/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def __init__(
of the sequence should be the same as the number of classes. If not ``include_background``,
the number of classes should not include the background category class 0).
The value/values should be no less than 0. Defaults to None.
soft_label: whether the target contains non-binary values or not
soft_label: whether the target contains non-binary values (soft labels) or not.
If True a soft label formulation of the loss will be used.
Raises:
TypeError: When ``other_act`` is not an ``Optional[Callable]``.
Expand Down Expand Up @@ -302,7 +303,8 @@ def __init__(
batch: whether to sum the intersection and union areas over the batch dimension before the dividing.
Defaults to False, intersection over union is computed from each item in the batch.
If True, the class-weighted intersection and union areas are first summed across the batches.
soft_label: whether the target contains non-binary values or not
soft_label: whether the target contains non-binary values (soft labels) or not.
If True a soft label formulation of the loss will be used.
Raises:
TypeError: When ``other_act`` is not an ``Optional[Callable]``.
Expand Down
3 changes: 2 additions & 1 deletion monai/losses/tversky.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def __init__(
batch: whether to sum the intersection and union areas over the batch dimension before the dividing.
Defaults to False, a Dice loss value is computed independently from each item in the batch
before any `reduction`.
soft_label: whether the target contains non-binary values or not
soft_label: whether the target contains non-binary values (soft labels) or not.
If True a soft label formulation of the loss will be used.
Raises:
TypeError: When ``other_act`` is not an ``Optional[Callable]``.
Expand Down
2 changes: 0 additions & 2 deletions monai/losses/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ def compute_tp_fp_fn(
Adapted from:
https://github.com/zifuwanggg/JDTLosses
"""
if torch.unique(target).shape[0] > 2 and not soft_label:
warnings.warn("soft labels are used, but `soft_label == False`.")

# the original implementation that is erroneous with soft labels
if ord == 1 and not soft_label:
Expand Down

0 comments on commit aeef0af

Please sign in to comment.