- paddle. logical_not ( x, out=None, name=None )
logical_notoperator computes element-wise logical NOT on
x, and returns
outare N-dim boolean
Variable. Each element of
outis calculated by\[out = !x\]
x (Tensor) – Operand of logical_not operator. Must be a Tensor of type bool.
out (Tensor) – The
Tensorthat specifies the output of the operator, which can be any
Tensorthat has been created in the program. The default value is None, and a new ``Tensor` will be created to save the output.
name (str|None) – The default value is None. Normally there is no need for users to set this property. For more information, please refer to Name.
n-dim bool LoDTensor or Tensor
- Return type
import paddle x = paddle.to_tensor([True, False, True, False]) res = paddle.logical_not(x) print(res) # [False True False True]