You shouldn’t get an illegal memory access, as assert statements should guard it properly. Which PyTorch version are you using and could you post a minimal code snippet to reproduce the memory violation in case you are using the latest release?


If you are using the latest release and are facing the shape issue, could you create an issue/feature request on GitHub so that we could check if changing the returned shape would be feasible?