oneflow.negative

oneflow.negative()

This operator computes the negative value of Tensor.

Parameters

input (oneflow.Tensor) – A Tensor

Returns

The result Tensor

Return type

oneflow.Tensor

For example:

>>> import numpy as np
>>> import oneflow as flow

>>> input = flow.tensor(
...    np.array([1.0, -1.0, 2.3]).astype(np.float32), dtype=flow.float32
... )
>>> out = flow.negative(input)
>>> out
tensor([-1.0000,  1.0000, -2.3000], dtype=oneflow.float32)