Commit 565a794
Recover non-standard bool test for msort (#139870)
Summary:
I was looking into why the non-standard bool value will fail for msort - it makes sense for argsort and sort to fail, because we're randomly generating uint8 so the order will be different (and thus the indices will be different). But msort should work.
After some digging, it's interesting that even though scalar_t is bool, when the actual value is a uint8_t, the comparison will treat them as signed. I tried lhs=255 and rhs=0: lhs < rhs is equivalent to -1 < 0 which is true (but it's supposed to be False)
Therefore we add an explicit type cast.
Test Plan: Remove the test skip
Differential Revision: D65472170
Pull Request resolved: #139870
Approved by: https://github.com/Skylion007, https://github.com/davidberard981 parent 2f3a5a1 commit 565a794
2 files changed
Lines changed: 6 additions & 3 deletions
File tree
- aten/src/ATen/native/cuda
- torch/testing/_internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19517 | 19517 | | |
19518 | 19518 | | |
19519 | 19519 | | |
| 19520 | + | |
19520 | 19521 | | |
19521 | | - | |
| 19522 | + | |
19522 | 19523 | | |
19523 | 19524 | | |
19524 | 19525 | | |
| |||
0 commit comments