mindspore.ops.Ceil

View Source On Gitee
class mindspore.ops.Ceil[source]

Rounds a tensor up to the closest integer element-wise.

Refer to mindspore.ops.ceil() for more details.

Inputs:
  • x (Tensor) - The input tensor with a dtype of float16 or float32.

Outputs:

Tensor, has the same shape as x.

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)
>>> ceil_op = ops.Ceil()
>>> output = ceil_op(x)
>>> print(output)
[ 2.  3. -1.]
>>> x = Tensor(2.1, mindspore.float32)
>>> output = ceil_op(x)
>>> print(output)
3.0