mindspore.ops.LogicalNot

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

Computes the “logical NOT” of a tensor element-wise.

Inputs:
  • input_x (Tensor) - The input tensor whose dtype is bool.

Outputs:

Tensor, the shape is the same as the input_x, and the dtype is bool.

Raises

TypeError – If input_x is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> input_x = Tensor(np.array([True, False, True]), mindspore.bool_)
>>> logical_not = ops.LogicalNot()
>>> output = logical_not(input_x)
>>> print(output)
[False  True False]