Cowardly refusing to serialize non-leaf tensor which requires_grad

Hi Folks,

I cross-checked a couple of times. I never serialize tensor with grad, but I still get this error.
Cowardly refusing to serialize non-leaf tensor which requires_grad, since autograd does not support crossing process boundaries. If you just want to transfer the data, call detach() on the tensor before serializing .

How can I find what tensor actually causing this ? Becase if multiprocess so that couldn’t happen on a backward pass. I never actually put anything on the queue with grad.

It is either something in /popen_spawn_posix.py", line 47, in _launch or torch somehow reconstructed somewhere tensor in another process, and I believe they are connected. (in a graph)

How I can trace this tensor ?

1 Like