mindspore.ops.LogicalNot
- class mindspore.ops.LogicalNot(*args, **kwargs)[source]
Computes the “logical NOT” of a tensor element-wise.
\[out_{i} = \neg x_{i}\]- Inputs:
x (Tensor) - The input tensor whose dtype is bool. \((N,*)\) where \(*\) means,any number of additional dimensions.
- Outputs:
Tensor, the shape is the same as the x, and the dtype is bool.
- Raises
TypeError – If x is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([True, False, True]), mindspore.bool_) >>> logical_not = ops.LogicalNot() >>> output = logical_not(x) >>> print(output) [False True False]