qml.math.abs

abs(tensor)

Returns the element-wise absolute value.

Parameters

tensor (tensor_like) – input tensor

Returns

Return type

tensor_like

Example

>>> a = torch.tensor([1., -2.], requires_grad=True)
>>> abs(a)
tensor([1., 2.], grad_fn=<AbsBackward>)