mindspore/docs/api/api_python/ops/mindspore.ops.SmoothL1Loss.rst

36 lines
1.5 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.SmoothL1Loss
============================
.. py:class:: mindspore.ops.SmoothL1Loss(beta=1.0, reduction='none')
计算平滑L1损失该L1损失函数有稳健性。
.. warning::
该API在CPU上性能较差推荐在Ascend/GPU上运行。
更多参考详见 :func:`mindspore.ops.smooth_l1_loss`
参数:
- **beta** (number可选) - 控制损失函数在L1损失和L2损失间变换的阈值默认值 ``1.0``
- Ascend该值必须大于等于0。
- CPU/GPU该值必须大于0。
- **reduction** (str可选) - 指定应用于输出结果的归约计算方式,可选 ``'none'````'mean'````'sum'`` ,默认值: ``'none'``
- ``"none"``:不应用归约方法。
- ``"mean"``:计算输出元素的平均值。
- ``"sum"``:计算输出元素的总和。
输入:
- **logits** (Tensor) - 任意维度输入Tensor。支持数据类型
- Ascendfloat16、float32、bfloat16。
- CPU/GPUfloat16、float32、float64。
- **labels** (Tensor) - 真实值。
- CPU/Ascend: 与 `logits` 的shape相同 `logits``labels` 遵循隐式类型转换规则,使数据类型一致。
- GPU: 与 `logits` 的shape和数据类型相同。
输出:
Tensor如果 `reduction```'none'``则输出Tensor的shape与 `logits` 的shape相同否则shape为 :math:`()`