mindspore.Tensor.invert
- Tensor.invert()[source]
Flips all bits of this Tensor element-wise.
\[out_i = \sim x_{i}\]where x refers to self Tensor.
- Returns
Tensor, has the same shape as as self Tensor.
- Raises
TypeError – If dtype of this Tensor is neither int16 nor uint16.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([25, 4, 13, 9]), mindspore.int16) >>> output = x.invert() >>> print(output) [-26 -5 -14 -10]