pytorch
bc93454e - correctly set strides for expanded/unsqueezed dimensions (#90341)

Commit
1 year ago
correctly set strides for expanded/unsqueezed dimensions (#90341) Fixes https://github.com/pytorch/torchdynamo/issues/1959, #90260 However, I wasn't able to make existing stride tests fail before the fix, even though I'm comparing all, not just significant strides. Separately running refs on meta tensors produces wrong strides as shown in #90260, however, it looks like in meta tests some other way of computing meta info is used (I've been running ``` pytest -s -v test/test_meta.py -k test_meta_outplace_expand_cuda_float64 ``` and verified that it has sample input that should fail, and that it indeed compares all the strides, but the produced `meta_rs` results somehow still had correct strides). Edit: @SherlockNoMad helped me figure out how to fail the tests, and now I've set the correct ops for checking. `expand` fails for some test inputs because it special-cases 0-dim input case, correctly modeling it in prims would require a lot of changes, so skipping that for now. Pull Request resolved: https://github.com/pytorch/pytorch/pull/90341 Approved by: https://github.com/SherlockNoMad
Author
Natalia Gimelshein
Committer
Parents
Loading