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