forked from mindspore-Ecosystem/mindspore
!48253 modify the name and samples of nn function multilabel_margin_loss.
Merge pull request !48253 from 朱家兴/master
This commit is contained in:
commit
9bb62cb742
|
@ -65,7 +65,7 @@ mindspore.ops
|
|||
mindspore.ops.margin_ranking_loss
|
||||
mindspore.ops.mse_loss
|
||||
mindspore.ops.multi_margin_loss
|
||||
mindspore.ops.multi_label_margin_loss
|
||||
mindspore.ops.multilabel_margin_loss
|
||||
mindspore.ops.multilabel_soft_margin_loss
|
||||
mindspore.ops.nll_loss
|
||||
mindspore.ops.smooth_l1_loss
|
||||
|
|
|
@ -8,4 +8,4 @@ mindspore.ops.MultilabelMarginLoss
|
|||
创建一个标准,用于优化输入 :math:`x` (一个2D小批量Tensor)
|
||||
和输出 :math:`y` (一个目标类别索引的2DTensor)之间的多类分类铰链损失(基于边距的损失)。
|
||||
|
||||
更多细节请参考 :func:`mindspore.ops.multi_label_margin_loss` 。
|
||||
更多细节请参考 :func:`mindspore.ops.multilabel_margin_loss` 。
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mindspore.ops.multi_label_margin_loss
|
||||
mindspore.ops.multilabel_margin_loss
|
||||
======================================
|
||||
|
||||
.. py:function:: mindspore.ops.multi_label_margin_loss(inputs, target, reduction='mean')
|
||||
.. py:function:: mindspore.ops.multilabel_margin_loss(inputs, target, reduction='mean')
|
||||
|
||||
用于优化多标签分类问题的铰链损失。
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ Loss Functions
|
|||
mindspore.ops.margin_ranking_loss
|
||||
mindspore.ops.mse_loss
|
||||
mindspore.ops.multi_margin_loss
|
||||
mindspore.ops.multi_label_margin_loss
|
||||
mindspore.ops.multilabel_margin_loss
|
||||
mindspore.ops.multilabel_soft_margin_loss
|
||||
mindspore.ops.nll_loss
|
||||
mindspore.ops.smooth_l1_loss
|
||||
|
|
|
@ -468,7 +468,7 @@ from .nn_func import (
|
|||
conv3d,
|
||||
glu,
|
||||
multi_margin_loss,
|
||||
multi_label_margin_loss,
|
||||
multilabel_margin_loss,
|
||||
multilabel_soft_margin_loss,
|
||||
elu,
|
||||
gelu,
|
||||
|
|
|
@ -5197,7 +5197,7 @@ def multi_margin_loss(inputs, target, p=1, margin=1, weight=None, reduction='mea
|
|||
return outputs
|
||||
|
||||
|
||||
def multi_label_margin_loss(inputs, target, reduction='mean'):
|
||||
def multilabel_margin_loss(inputs, target, reduction='mean'):
|
||||
r"""
|
||||
Hinge loss for optimizing a multi-label classification.
|
||||
|
||||
|
@ -5248,10 +5248,9 @@ def multi_label_margin_loss(inputs, target, reduction='mean'):
|
|||
Examples:
|
||||
>>> inputs = Tensor(np.array([[0.1, 0.2, 0.4, 0.8], [0.2, 0.3, 0.5, 0.7]]), mindspore.float32)
|
||||
>>> target = Tensor(np.array([[1, 2, 0, 3], [2, 3, -1, 1]]), mindspore.int32)
|
||||
>>> output, _ = ops.multi_label_margin_loss(inputs, target)
|
||||
>>> output = ops.multilabel_margin_loss(inputs, target)
|
||||
>>> print(output)
|
||||
(Tensor(shape=[], dtype=Float32, value= 0.325), Tensor(shape=[2, 4], dtype=Int32, value=
|
||||
[[1, 1, 1, 1], [0, 0, 1, 1]]))
|
||||
0.325
|
||||
"""
|
||||
|
||||
loss = _get_cache_prim(P.MultilabelMarginLoss)(reduction)
|
||||
|
@ -5851,7 +5850,7 @@ __all__ = [
|
|||
'glu',
|
||||
'margin_ranking_loss',
|
||||
'multi_margin_loss',
|
||||
'multi_label_margin_loss',
|
||||
'multilabel_margin_loss',
|
||||
'multilabel_soft_margin_loss',
|
||||
'elu',
|
||||
'gelu',
|
||||
|
|
|
@ -8808,7 +8808,7 @@ class MultilabelMarginLoss(Primitive):
|
|||
hinge loss (margin-based loss) between input :math:`x` (a 2D mini-batch `Tensor`)
|
||||
and output :math:`y` (which is a 2D `Tensor` of target class indices).
|
||||
|
||||
Refer to :func:`mindspore.ops.multi_label_margin_loss` for more details.
|
||||
Refer to :func:`mindspore.ops.multilabel_margin_loss` for more details.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU``
|
||||
|
|
Loading…
Reference in New Issue