mindspore.ops.Invert

class mindspore.ops.Invert(*args, **kwargs)[source]

Flips all bits of input tensor element-wise.

Inputs:
  • input_x (Tensor[int16], Tensor[uint16]) - The shape of tensor is \((x_1, x_2, ..., x_R)\).

Outputs:

Tensor, has the same shape as input_x.

Raises

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

Supported Platforms:

Ascend

Examples

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