mindspore.numpy.ceil
- mindspore.numpy.ceil(x, dtype=None)[源代码]
- 返回输入的向上取整结果,逐元素计算。 标量 x 的向上取整得到最小的整数 i,满足 - i >= x。- 说明 - 不支持NumPy参数 out 、 where 、 casting 、 order 、 subok 、 signature 、 extobj 。 在GPU上,支持的类型有np.float16和np.float32。 - 参数:
- x (Tensor) - 输入值。 
- dtype (mindspore.dtype, 可选) - 默认值: - None。 覆盖输出Tensor的dtype。
 
- 返回:
- Tensor或标量, x 中每个元素的向上取整结果。 如果 x 是标量,则结果也是标量。 
- 支持平台:
- Ascend- GPU- CPU
 - 样例: - >>> import mindspore.numpy as np >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> output = np.ceil(a) >>> print(output) [-1. -1. -0. 1. 2. 2. 2.]