pytorch
a34736f7 - fix sort and topk with discontiguous out (#63029)

Commit
3 years ago
fix sort and topk with discontiguous out (#63029) Summary: Fixes https://github.com/pytorch/pytorch/issues/62645 and https://github.com/pytorch/pytorch/issues/62940. The root cause of those bugs is in the bad interaction between `collapseDims` and setting the size of sorting/topK dimension to 1. If all other dimensions happen to be 1, `collapseDims` thinks that that `1` dimension is collapsible (even though it was specifically marked to be preserved) and loses its stride information. If dimension was really of size 1, the stride information would be unimportant, but since in reality that dimension is not 1 and was set to 1 for convenience, the loss of stride information results in incorrect outputs. Pull Request resolved: https://github.com/pytorch/pytorch/pull/63029 Reviewed By: heitorschueroff Differential Revision: D30224925 Pulled By: ngimel fbshipit-source-id: 269dd375c5cd57c6007fe91f729f8c60a2e7a264
Author
Natalia Gimelshein
Committer
Parents
Loading