Skip to content

Commit 6982a6c

Browse files
authored
Update dice.py
The dice loss varies with batch sizes, and this issue remains unresolved. #712 (comment)
1 parent cf50cd0 commit 6982a6c

File tree

1 file changed

+1
-1
lines changed
  • segmentation_models_pytorch/losses

1 file changed

+1
-1
lines changed

segmentation_models_pytorch/losses/dice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def forward(self, y_pred: torch.Tensor, y_true: torch.Tensor) -> torch.Tensor:
7070

7171
bs = y_true.size(0)
7272
num_classes = y_pred.size(1)
73-
dims = (0, 2)
73+
dims = (2)
7474

7575
if self.mode == BINARY_MODE:
7676
y_true = y_true.view(bs, 1, -1)

0 commit comments

Comments
 (0)