asc2.negative

asc2.negative(input: LocalTensor) LocalTensor

Computes the element-wise negation of input.

The supported data types for the input are: int16, int32, int64, float16, bfloat16, 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 negation of all tensor elements:

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

This function can also be called via an unary operator on LocalTensor, as -input instead of negative(input).