!14393 Solve the example problem in comments

From: @lijiaqi0612
Reviewed-by: @kisnwang,@zh_qh
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2021-03-30 20:43:30 +08:00 committed by Gitee
commit dda9f548ee
3 changed files with 4 additions and 4 deletions

View File

@ -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'):

View File

@ -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):

View File

@ -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,