logical_not¶
- paddle. logical_not ( x, out=None, name=None ) [source]
-
logical_not
operator computes element-wise logical NOT onx
, and returnsout
.out
is N-dim booleanVariable
. Each element ofout
is calculated by\[out = !x\]Note
paddle.logical_not
supports broadcasting. If you want know more about broadcasting, please refer to Introduction to Tensor .- Parameters
-
x (Tensor) – Operand of logical_not operator. Must be a Tensor of type bool, int8, int16, in32, in64, float16, float32, or float64, complex64, complex128.
out (Tensor) – The
Tensor
that specifies the output of the operator, which can be anyTensor
that 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.
- Returns
-
N-D Tensor. A location into which the result is stored. It’s dimension equals with
x
.
Examples
>>> import paddle >>> x = paddle.to_tensor([True, False, True, False]) >>> res = paddle.logical_not(x) >>> print(res) Tensor(shape=[4], dtype=bool, place=Place(cpu), stop_gradient=True, [False, True , False, True ])