asc2.abs

asc2.abs(input: LocalTensor) LocalTensor

Computes the element-wise absolute value of input.

The supported data types for the input are: int8, int16, int32, int64, float16, float32.

Parameters:

input – The input value (tensor)

Returns:

The result tensor

Return type:

LocalTensor

Raises:

RuntimeError – If the input dtype is not supported for this operation

Examples

Compute the element-wise absolute value of all tensor elements:

input = asc2.copy_in(tensor, [0, 0], [128, 256])
result = asc2.abs(input)

This function can also be called as a member function on LocalTensor, as input.abs(...) instead of abs(input, ...).