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 outi=⌈inputi⌉ 參數 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.])