mindspore.ops.Ceil

class mindspore.ops.Ceil[source]

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

\[out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1\]
Inputs:
  • x (Tensor) - The input tensor. It’s element data type must be float16 or float32. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should be less than 8.

Outputs:

Tensor, has the same shape as x.

Raises
  • TypeError – If x is not a Tensor.

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

Supported Platforms:

Ascend

Examples

>>> 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.]