PyTorch torch.ceil 函数
torch.ceil 是 PyTorch 中用于逐元素向上取整的函数。
函数定义
torch.ceil(input, out=None)
使用示例
实例
import torch
x = torch.tensor([1.1, 2.5, 3.7, -1.2])
print(torch.ceil(x))
x = torch.tensor([1.1, 2.5, 3.7, -1.2])
print(torch.ceil(x))
输出结果为:
tensor([2., 3., 4., -1.])

Pytorch torch 参考手册