mindspore.ops.ceil
- mindspore.ops.ceil(input)[source]
Rounds a tensor up to the closest integer element-wise.
\[out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1\]- Parameters
input (Tensor) –
the input of Ceil. Supported dtypes:
Ascend: float16, float32, float64 or bfloat16.
GPU/CPU: float16, float32, float64.
- Returns
Tensor, has the same shape as input.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input = Tensor(np.array([1.1, 2.5, -1.5]), mindspore.float32) >>> output = ops.ceil(input) >>> print(output) [ 2. 3. -1.] >>> input = Tensor(2.1, mindspore.float32) >>> output = ops.ceil(input) >>> print(output) 3.0