Shortcuts

torch.floor

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

Returns a new tensor with the floor of the elements of input, the largest integer less than or equal to each element.

outi=inputi\text{out}_{i} = \left\lfloor \text{input}_{i} \right\rfloor
Parameters

input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

>>> a = torch.randn(4)
>>> a
tensor([-0.8166,  1.5308, -0.2530, -0.2091])
>>> torch.floor(a)
tensor([-1.,  1., -1., -1.])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources