mindspore.ops.SmoothL1Loss

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

Refer to mindspore.ops.smooth_l1_loss() for more detail.

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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]