forked from mindspore-Ecosystem/mindspore
!14393 Solve the example problem in comments
From: @lijiaqi0612 Reviewed-by: @kisnwang,@zh_qh Signed-off-by: @zh_qh
This commit is contained in:
commit
dda9f548ee
|
@ -452,7 +452,7 @@ class DiceLoss(_Loss):
|
|||
single_dice_coeff = (2 * intersection) / (unionset + self.smooth)
|
||||
dice_loss = 1 - single_dice_coeff
|
||||
|
||||
return dice_loss.mean()
|
||||
return dice_loss
|
||||
|
||||
|
||||
@constexpr
|
||||
|
@ -1078,7 +1078,7 @@ class FocalLoss(_Loss):
|
|||
>>> focalloss = nn.FocalLoss(weight=Tensor([1, 2]), gamma=2.0, reduction='mean')
|
||||
>>> output = focalloss(predict, target)
|
||||
>>> print(output)
|
||||
1.6610543
|
||||
0.12516622
|
||||
"""
|
||||
|
||||
def __init__(self, weight=None, gamma=2.0, reduction='mean'):
|
||||
|
|
|
@ -38,7 +38,7 @@ class BleuScore(Metric):
|
|||
>>> metric.clear()
|
||||
>>> metric.update(candidate_corpus, reference_corpus)
|
||||
>>> bleu_score = metric.eval()
|
||||
>>> print(output)
|
||||
>>> print(bleu_score)
|
||||
0.5946035575013605
|
||||
"""
|
||||
def __init__(self, n_gram=4, smooth=False):
|
||||
|
|
|
@ -182,7 +182,7 @@ class ConfusionMatrixMetric(Metric):
|
|||
>>> y = Tensor(np.array([[[0], [1]], [[1], [0]]]))
|
||||
>>> avg_output = metric.eval()
|
||||
>>> print(avg_output)
|
||||
[0.75]
|
||||
[0.5]
|
||||
"""
|
||||
def __init__(self,
|
||||
skip_channel=True,
|
||||
|
|
Loading…
Reference in New Issue