mirror of https://github.com/llvm/torch-mlir
d11d6f6fea
Closes #3575 The PyTorch remainder operator is meant to compute the Python modulus operator entrywise: https://pytorch.org/docs/stable/generated/torch.remainder.html#torch.remainder In python the modulus operator is meant to always return a result with the same sign as the divisor: https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations In other words, torch.aten.remainder should return a Python-style modulus instead of a C-style modulus. However the remainder operator was simply translated into arith.ModSI or arith.ModF, which both effectively compute the C-style modulus. Now the lowering has been modified so that the modulus operator works properly with negative numbers, both in the dividend, and the divisor. |
||
---|---|---|
.. | ||
CAPI | ||
Conversion | ||
Dialect | ||
RefBackend | ||
CMakeLists.txt | ||
InitAll.cpp |