bitwise_invert

paddle. bitwise_invert ( x: Tensor, out: Tensor | None = None, name: str | None = None ) Tensor [source]

Apply bitwise_not (bitwise inversion) on Tensor x.

This is an alias to the paddle.bitwise_not function.

\[Out = \sim X\]

Note

paddle.bitwise_invert is functionally equivalent to paddle.bitwise_not.

Parameters
  • x (Tensor) – Input Tensor of bitwise_invert. It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.

  • out (Tensor|None, optional) – Result of bitwise_invert. It is a N-D Tensor with the same data type as the input Tensor. Default: None.

  • name (str|None, optional) – The default value is None. This property is typically not set by the user. For more information, please refer to Name.

Returns

Result of bitwise_invert. It is a N-D Tensor with the same data type as the input Tensor.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.to_tensor([-5, -1, 1])
>>> res = x.bitwise_invert()
>>> print(res)
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
[ 4,  0, -2])