快捷鍵

torch.ceil

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

回傳一個新的 tensor,其中包含 input 元素的 ceil 值,即大於或等於每個元素的最小整數。

對於整數輸入,遵循 array-api 慣例,回傳輸入 tensor 的副本。

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

input (Tensor) – 輸入 tensor。

關鍵字參數

out (Tensor, optional) – 輸出 tensor。

範例

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

文件

取得 PyTorch 的完整開發人員文件

檢視文件

教學

取得適合初學者和進階開發人員的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源