mindspore.ops.ceil

mindspore.ops.ceil(x)[source]

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

\[out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1\]
Parameters

x (Tensor) – The input tensor with a dtype of float16 or float32, its rank must be in [0, 7] inclusive.

Returns

Tensor, has the same shape as the x.

Raises
  • TypeError – If x is not a Tensor.

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

Supported Platforms:

Ascend GPU CPU

Examples

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