diff --git a/docs/api/api_python/mindspore.ops.rst b/docs/api/api_python/mindspore.ops.rst index 71dc8f55db6..ad100f5eed2 100644 --- a/docs/api/api_python/mindspore.ops.rst +++ b/docs/api/api_python/mindspore.ops.rst @@ -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 diff --git a/docs/api/api_python/ops/mindspore.ops.MultilabelMarginLoss.rst b/docs/api/api_python/ops/mindspore.ops.MultilabelMarginLoss.rst index 00d83330218..97c0af60fac 100644 --- a/docs/api/api_python/ops/mindspore.ops.MultilabelMarginLoss.rst +++ b/docs/api/api_python/ops/mindspore.ops.MultilabelMarginLoss.rst @@ -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` 。 diff --git a/docs/api/api_python/ops/mindspore.ops.func_multi_label_margin_loss.rst b/docs/api/api_python/ops/mindspore.ops.func_multi_label_margin_loss.rst index 3ecd8827fa4..a6f8493a467 100644 --- a/docs/api/api_python/ops/mindspore.ops.func_multi_label_margin_loss.rst +++ b/docs/api/api_python/ops/mindspore.ops.func_multi_label_margin_loss.rst @@ -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') 用于优化多标签分类问题的铰链损失。 diff --git a/docs/api/api_python_en/mindspore.ops.rst b/docs/api/api_python_en/mindspore.ops.rst index 28ecdc38be0..b2dfcda5f2f 100644 --- a/docs/api/api_python_en/mindspore.ops.rst +++ b/docs/api/api_python_en/mindspore.ops.rst @@ -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 diff --git a/mindspore/python/mindspore/ops/function/__init__.py b/mindspore/python/mindspore/ops/function/__init__.py index 2a0612bc341..c0780585149 100644 --- a/mindspore/python/mindspore/ops/function/__init__.py +++ b/mindspore/python/mindspore/ops/function/__init__.py @@ -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, diff --git a/mindspore/python/mindspore/ops/function/nn_func.py b/mindspore/python/mindspore/ops/function/nn_func.py index d251dad8153..dac94456e00 100644 --- a/mindspore/python/mindspore/ops/function/nn_func.py +++ b/mindspore/python/mindspore/ops/function/nn_func.py @@ -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', diff --git a/mindspore/python/mindspore/ops/operations/nn_ops.py b/mindspore/python/mindspore/ops/operations/nn_ops.py index 8764d7218ef..7a13e9f5f07 100644 --- a/mindspore/python/mindspore/ops/operations/nn_ops.py +++ b/mindspore/python/mindspore/ops/operations/nn_ops.py @@ -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``