RuntimeError: setStorage: sizes [4096, 4096], strides [1, 4096], storage offset 0, and itemsize 2 requiring a storage size of 33554432 are out of bounds for storage of size 0

compute-sanitizer should be able to detect the kernel causing the illegal memory access. If you get stuck, post a minimal and executable code snippet to reproduce the issue.