abs

tripy.abs(input: Tensor) Tensor[source]

Computes the elementwise absolute value of the elements of the input tensor.

Parameters:

input (Tensor) – [dtype=T1] The input tensor.

Returns:

[dtype=T1] A new tensor of the same shape with all non-negative entries

Return type:

Tensor

TYPE CONSTRAINTS:
Example
Example
1input = tp.Tensor([-1, -2], dtype=tp.int32)
2output = tp.abs(input)
>>> input
tensor([-1, -2], dtype=int32, loc=gpu:0, shape=(2,))
>>> output
tensor([1, 2], dtype=int32, loc=gpu:0, shape=(2,))