快捷方式

torch.ceil

torch.ceil(input, *, out=None) Tensor

返回一個新的 Tensor,其中包含 input 中每個元素的向上取整值(即大於或等於每個元素的最小整數)。

對於整數輸入,遵循 array-api 約定,返回輸入 Tensor 的一個副本。

outi=inputi\text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil
引數

input (Tensor) – 輸入 Tensor。

關鍵字引數

out (Tensor, 可選的) – 輸出 Tensor。

示例

>>> a = torch.randn(4)
>>> a
tensor([-0.6341, -1.4208, -1.0900,  0.5826])
>>> torch.ceil(a)
tensor([-0., -1., -1.,  1.])

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源