torch.true_divide¶
-
torch.
true_divide
(dividend, divisor) → Tensor¶ Performs “true division” that always computes the division in floating point. Analogous to division in Python 3 and equivalent to
torch.div()
except when both inputs have bool or integer scalar types, in which case they are cast to the default (floating) scalar type before the division.- Parameters
- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> dividend = torch.tensor([5, 3], dtype=torch.int) >>> divisor = torch.tensor([3, 2], dtype=torch.int) >>> torch.true_divide(dividend, divisor) tensor([1.6667, 1.5000]) >>> torch.true_divide(dividend, 2) tensor([2.5000, 1.5000])