torch-mlir/lib/Conversion/TorchToLinalg
pkapris-syrmia d11d6f6fea
[TorchToLinalg] Fix torch.aten.remainder for negative operands (#3581)
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.
2024-08-13 21:17:21 +05:30
..
CMakeLists.txt Re-organize project structure to separate PyTorch dependencies from core project. (#2542) 2023-11-02 19:45:55 -07:00
DataMovement.cpp Add support for multiple dynamic reassociation dims for unflatten.int (#3504) 2024-06-28 09:59:51 -07:00
IndirectDataMovement.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
Linear.cpp Change linalg.matmul_unsigned to linalg.matmul with unsigned type_fn (#3587) 2024-08-02 11:32:24 -07:00
Pooling.cpp [torch] Add integer support for pooling operations (#3610) 2024-08-07 21:42:10 -07:00
PopulatePatterns.h Re-enable custom op support 2022-08-16 22:49:08 +05:30
Random.cpp [E2E][ONNX] torch.multinomial (#3404) 2024-07-16 23:09:39 +05:30
Reduction.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
TensorConstructors.cpp Adds misc fixes for some padding related issues (#3528) 2024-07-11 20:01:45 -05:00
TensorScalarInterop.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
TorchToLinalg.cpp [TorchToLinalg][ONNX] Add Basic Determinant Support (#3481) 2024-06-25 13:34:19 -05:00
Uncategorized.cpp [TorchToLinalg] Fix torch.aten.remainder for negative operands (#3581) 2024-08-13 21:17:21 +05:30
Utils.cpp Fix unused variable warning from assertion variable (#3512) 2024-06-28 12:20:29 -04:00