mindspore/docs/api/api_python/ops/mindspore.ops.MultilabelMar...

27 lines
1.4 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.MultilabelMarginLoss
==================================
.. py:class:: mindspore.ops.MultilabelMarginLoss(reduction='mean')
创建一个损失函数,用于最小化多分类任务的合页损失。
它以一个2D mini-batch Tensor :math:`x` 作为输入以包含目标类索引的2D Tensor :math:`y` 作为输出。
更多细节请参考 :func:`mindspore.ops.multilabel_margin_loss`
参数:
- **reduction** (str可选) - 指定应用于输出结果的规约计算方式,可选 ``'none'````'mean'````'sum'`` ,默认值: ``'mean'``
- ``'none'``:不应用规约方法。
- ``'mean'``:计算输出元素的平均值。
- ``'sum'``:计算输出元素的总和。
输入:
- **x** (Tensor) - 预测值。shape为 :math:`(C)`:math:`(N, C)`,其中 :math:`N`
为批量大小,:math:`C` 为类别数。数据类型必须为float16或float32。
- **target** (Tensor) - 真实标签shape与 `x` 相同数据类型必须为int32标签目标由-1填充。
输出:
- **y** (Union[Tensor, Scalar]) - MultilabelMarginLoss损失。如果 `reduction` 的值为 ``'none'``
那么返回shape为 :math:`(N)` 的Tensor类型数据。否则返回一个标量。
- **is_target** (Tensor) - 用于反向输入的Tensor其shape与 `target` 一致数据类型为int32。