PyTorch
torch / torch
torch.fmod¶
-
torch.
fmod
(input, other, *, out=None) → Tensor¶ Computes the element-wise remainder of division.
The dividend and divisor may contain both for integer and floating point numbers. The remainder has the same sign as the dividend
input
.When
other
is a tensor, the shapes ofinput
andother
must be broadcastable.- Parameters
- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> torch.fmod(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) tensor([-1., -0., -1., 1., 0., 1.]) >>> torch.fmod(torch.tensor([1., 2, 3, 4, 5]), 1.5) tensor([ 1.0000, 0.5000, 0.0000, 1.0000, 0.5000])
此页内容是否对您有帮助
感谢反馈!