okay so then the repro script you gave me is not the same as the script that you are running. I understand if it’s part of a larger code-base that you cant share. Step through in pdb and see what the size of grad_output is at tensor.py:276 2 as shown in the stack trace.