mindspore.numpy.signbit
- mindspore.numpy.signbit(x, dtype=None)[源代码]
- 逐元素扫描元素的符号位,如果符号位为1(即元素小于0)则返回True。 - 说明 - 不支持Numpy的 - out、- where、- casting、- order、- subok、- signature和- extobj参数。- 参数:
- x (Union[int, float, bool, list, tuple, Tensor]) - 输入值。 
- dtype (mindspore.dtype, 可选) - 默认值: - None。覆盖输出 Tensor的dtype。
 
- 返回:
- Tensor。 
- 异常:
- TypeError - 如果输入不是类似数组的对象,或者 - dtype不是- None或- bool。
 
- 支持平台:
- Ascend- GPU- CPU
 - 样例: - >>> import mindspore.numpy as np >>> x = np.array([1, -2.3, 2.1]).astype('float32') >>> output = np.signbit(x) >>> print(output) [False True False]