torch.ceil
- torch.ceil(input, *, out=None) → Tensor
-
返回一个新的张量,其中包含
input
中每个元素的天花板值(即大于或等于每个元素的最小整数)。对于整数输入,按照array-api规范返回输入张量的副本。
$\text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil$示例:
>>> a = torch.randn(4) >>> a tensor([-0.6341, -1.4208, -1.0900, 0.5826]) >>> torch.ceil(a) tensor([-0., -1., -1., 1.])