Skip to content

Commit aeef0af

Browse files
committed
Modify args description and remove check
1 parent a778e58 commit aeef0af

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

monai/losses/dice.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def __init__(
9999
of the sequence should be the same as the number of classes. If not ``include_background``,
100100
the number of classes should not include the background category class 0).
101101
The value/values should be no less than 0. Defaults to None.
102-
soft_label: whether the target contains non-binary values or not
102+
soft_label: whether the target contains non-binary values (soft labels) or not.
103+
If True a soft label formulation of the loss will be used.
103104
104105
Raises:
105106
TypeError: When ``other_act`` is not an ``Optional[Callable]``.
@@ -302,7 +303,8 @@ def __init__(
302303
batch: whether to sum the intersection and union areas over the batch dimension before the dividing.
303304
Defaults to False, intersection over union is computed from each item in the batch.
304305
If True, the class-weighted intersection and union areas are first summed across the batches.
305-
soft_label: whether the target contains non-binary values or not
306+
soft_label: whether the target contains non-binary values (soft labels) or not.
307+
If True a soft label formulation of the loss will be used.
306308
307309
Raises:
308310
TypeError: When ``other_act`` is not an ``Optional[Callable]``.

monai/losses/tversky.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def __init__(
7575
batch: whether to sum the intersection and union areas over the batch dimension before the dividing.
7676
Defaults to False, a Dice loss value is computed independently from each item in the batch
7777
before any `reduction`.
78-
soft_label: whether the target contains non-binary values or not
78+
soft_label: whether the target contains non-binary values (soft labels) or not.
79+
If True a soft label formulation of the loss will be used.
7980
8081
Raises:
8182
TypeError: When ``other_act`` is not an ``Optional[Callable]``.

monai/losses/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ def compute_tp_fp_fn(
2929
Adapted from:
3030
https://github.com/zifuwanggg/JDTLosses
3131
"""
32-
if torch.unique(target).shape[0] > 2 and not soft_label:
33-
warnings.warn("soft labels are used, but `soft_label == False`.")
3432

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

0 commit comments

Comments
 (0)