Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.ceil function

PyTorch torch.ceil function


PyTorch torch reference manual PyTorch torch reference manual

torch.ceil is a function in PyTorch used to round each element up to the nearest integer.

Function definition

torch.ceil(input, out=None)


Usage examples

Example

import

torch

x

=

torch.

tensor

(

[

1.1

,

2.5

,

3.7

,

1.2

]

)

print

(

torch.

ceil

(

x

)

)

The output is:

tensor([2., 3., 4., -1.])


PyTorch torch reference manual PyTorch torch reference manual