mindspore.mint.ceil

View Source On Gitee
mindspore.mint.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.

Returns

Tensor, has the same shape as input.

Raises
  • TypeError – If input is not a Tensor.

  • TypeError – If dtype of input is not float16, float32, float64 or bfloat16.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, mint
>>> input = Tensor(np.array([1.1, 2.5, -1.5]), mindspore.float32)
>>> output = mint.ceil(input)
>>> print(output)
[ 2.  3. -1.]
>>> input = Tensor(2.1, mindspore.float32)
>>> output = mint.ceil(input)
>>> print(output)
3.0