Is there modulus operator `torch.mod`?

For the modulus operator, is there a torch.mod existing ?

3 Likes

You have the torch.fmod and torch.remainder functions.
The difference between the two is how they handle negative numbers, see the docs for more details.

5 Likes

Python’s modulo operator % is also implemented for tensors.

1 Like