Shortcuts

torch.floor_divide

torch.floor_divide(input, other, out=None) → Tensor

Return the division of the inputs rounded down to the nearest integer. See torch.div() for type promotion and broadcasting rules.

outi=inputiotheri\text{{out}}_i = \left\lfloor \frac{{\text{{input}}_i}}{{\text{{other}}_i}} \right\rfloor
Parameters
  • input (Tensor) – the numerator tensor

  • other (Tensor or Scalar) – the denominator

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

>>> a = torch.tensor([4.0, 3.0])
>>> b = torch.tensor([2.0, 2.0])
>>> torch.floor_divide(a, b)
tensor([2.0, 1.0])
>>> torch.floor_divide(a, 1.4)
tensor([2.0, 2.0])

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