Example for One of the differentiated Tensors appears to not have been used in the graph

Hello. I have the same error, and I described my question in detail here:Calculating loss with autograd: One of the differentiated Tensors appears to not have been used in the graph

Is this happening because I need to create a custom pytorch function for the curl?