mindspore.ops.ceil

View Source On Gitee
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 tensor with a dtype of float16 or float32.

Returns

Tensor, has the same shape as the input.

Raises
  • TypeError – If input is not a Tensor.

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

Supported Platforms:

Ascend GPU CPU

Examples

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