mindspore.ops.Invert

class mindspore.ops.Invert[源代码]

Flips all bits of input tensor element-wise.

\[out_i = ~x_{i}\]
Inputs:
  • x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\). The data type should be one of the following types: int16, uint16.

Outputs:

Tensor, has the same shape as x.

Raises

TypeError – If dtype of x is neither int16 nor uint16.

Supported Platforms:

Ascend

Examples

>>> invert = ops.Invert()
>>> x = Tensor(np.array([25, 4, 13, 9]), mindspore.int16)
>>> output = invert(x)
>>> print(output)
[-26 -5 -14 -10]