mindspore.ops.SmoothL1Loss

class mindspore.ops.SmoothL1Loss(beta=1.0, reduction='none')[源代码]

计算平滑L1损失,该L1损失函数有稳健性。

更多参考详见 mindspore.ops.smooth_l1_loss()

支持平台:

Ascend GPU CPU

样例:

>>> loss = ops.SmoothL1Loss()
>>> logits = Tensor(np.array([1, 2, 3]), mindspore.float32)
>>> labels = Tensor(np.array([1, 2, 2]), mindspore.float32)
>>> output = loss(logits, labels)
>>> print(output)
[0.  0.  0.5]