oneflow.ceil

oneflow.ceil()

Returns a new tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element.

The equation is:

\[\text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil = \left\lfloor \text{input}_{i} \right\rfloor + 1\]
Parameters

input (oneflow.Tensor) – A Tensor.

Returns

The result Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> import numpy as np
>>> x = flow.tensor(np.array([0.1, -2, 3.4]).astype(np.float32))
>>> y = flow.ceil(x)
>>> y.shape
oneflow.Size([3])
>>> y
tensor([ 1., -2.,  4.], dtype=oneflow.float32)
>>> x = flow.tensor(np.array([[2.5, 4.6, 0.6],[7.8, 8.3, 9.2]]).astype(np.float32))
>>> y = x.ceil()
>>> y.shape
oneflow.Size([2, 3])
>>> y
tensor([[ 3.,  5.,  1.],
        [ 8.,  9., 10.]], dtype=oneflow.float32)
>>> x = flow.tensor(np.array([[[2.2, 4.4, 6.5],[7.1, 8.2, 9.3]],[[10.6,11.2,12.2],[13.5,14.8,15.9]]]).astype(np.float32))
>>> y = flow.ceil(x)
>>> y.shape
oneflow.Size([2, 2, 3])
>>> y
tensor([[[ 3.,  5.,  7.],
         [ 8.,  9., 10.]],

        [[11., 12., 13.],
         [14., 15., 16.]]], dtype=oneflow.float32)