when the shape of input true is (B, H, W), dims is (0, 2). However, according to the definition of dice loss $1-\frac{2*I}{U}$, dims should be (2, 3), so I think the code here may be:
dims = tuple(range(2, logits.ndimension()))
Would you please double check or see if I misunderstood?
The function of dice loss in the code:
intersection
andcardinality
are calculated bywhen the shape of input
true
is (B, H, W),dims
is (0, 2). However, according to the definition of dice loss $1-\frac{2*I}{U}$,dims
should be (2, 3), so I think the code here may be:Would you please double check or see if I misunderstood?