mindspore.numpy.logical_not
- mindspore.numpy.logical_not(a, dtype=None)[源代码]
Computes the truth value of NOT a element-wise.
说明
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
- 参数
a (Tensor) – The input tensor whose dtype is bool.
dtype (
mindspore.dtype
, optional) – Default:None
. Overrides the dtype of the output Tensor.
- 返回
Tensor or scalar. Boolean result with the same shape as a of the NOT operation on elements of a. This is a scalar if a is a scalar.
- 异常
TypeError – If the input is not a tensor or its dtype is not bool.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> a = np.array([True, False]) >>> output = np.logical_not(a) >>> print(output) [False True]