Laith Sakka
15c8bdcc5e
Fix FloorDiv should not generate non integer rationals (due to sympy bug) (#164398)
FloorDiv eval have this optimization
```
# Expands (x + y) // b into x // b + y // b.
# This only works if floor is an identity, i.e. x / b is an integer.
```
Before this PR this optimization would generate a result in an expression like this. Duo to a bug in sympy.
```
Mul(Rational(1, 22), Add(Mul(Integer(24), Symbol('s37', integer=True, positive=True)), Integer(672)), FloorDiv(Mul(Symbol('s14', integer=True, positive=True), Symbol('s46', integer=True, positive=True)), Integer(2016)))
```
This is because in sympy an expression can have .is_integer =True yet have 1/22 in it!
This PR ensure we do not generate that by simply opting out if this optimization if we end
up with quotient that have such rational.
Fix
https://github.com/pytorch/pytorch/issues/164385,
https://github.com/pytorch/pytorch/issues/154996
https://github.com/pytorch/pytorch/issues/153375
https://github.com/pytorch/pytorch/issues/164063
and internal user issue.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164398
Approved by: https://github.com/jansel, https://github.com/isuruf
2025-10-02 22:51:03 +00:00
..
2025-09-29 03:35:32 +00:00
2025-10-02 22:51:03 +00:00
2025-06-12 23:51:42 +00:00
2025-09-30 03:56:54 +00:00
2025-10-01 16:48:32 +00:00
2025-09-27 06:09:50 +00:00
2025-01-21 21:04:10 +00:00
2025-07-08 18:10:33 +00:00
2025-03-06 12:04:46 +00:00
2025-10-01 16:48:32 +00:00
2025-07-25 02:56:34 +00:00
2025-07-29 17:40:49 +00:00
2025-09-29 03:35:32 +00:00
2025-09-29 04:40:44 +00:00
2025-06-11 01:33:24 +00:00
2025-03-11 18:49:21 +00:00
2025-09-29 03:35:32 +00:00
2025-09-29 04:40:44 +00:00
2025-06-12 23:51:42 +00:00
2025-09-29 03:35:32 +00:00
2025-10-02 07:39:54 +00:00
2025-07-02 22:55:29 +00:00
2025-04-28 03:52:47 +00:00
2025-09-29 03:35:32 +00:00
2024-12-12 01:18:34 +00:00
2025-09-29 03:35:32 +00:00
2025-09-29 03:35:32 +00:00
2025-05-31 19:27:56 +00:00
2025-06-11 19:44:18 +00:00
2025-07-29 17:40:49 +00:00
2025-06-12 23:51:42 +00:00
2025-08-04 18:08:01 +00:00
2025-09-21 01:45:46 +00:00
2025-09-29 03:35:32 +00:00
2025-09-29 03:35:32 +00:00
2025-09-29 03:35:32 +00:00
2025-06-12 23:51:42 +00:00
2025-09-16 04:46:11 +00:00
2025-01-26 03:41:00 +00:00
2025-06-12 23:51:42 +00:00
2025-10-01 21:32:59 +00:00
2025-09-29 03:35:32 +00:00
2025-08-26 22:32:35 +00:00
2025-07-29 17:40:49 +00:00
2024-06-08 18:50:06 +00:00
2025-10-01 02:22:06 +00:00
2024-06-08 18:50:06 +00:00
2025-07-20 00:46:20 +00:00
2025-04-15 20:25:29 +00:00
2025-09-30 19:59:43 +00:00
2025-06-10 04:42:06 +00:00
2024-06-08 18:50:06 +00:00
2025-01-21 21:04:10 +00:00
2025-08-07 00:09:56 +00:00
2025-01-27 18:08:07 +00:00
2024-06-08 18:50:06 +00:00
2025-07-15 05:06:55 +00:00