Hello,
I try to evaluate mu modele on gpu, but when I send data to gpu and the modele I get this error.
I searched for inplace errors but in this function (autograd) I did’nt find any.
Someone of you have an idea?
this is the error!
[
49 def Divergence(var:Tensor,Field:Tensor) → Tensor:
50     ones = torch.ones_like(Field)
—> 51     dFdvar = torch.autograd.grad(Field, var,
52                                 grad_outputs=ones,
53                                 create_graph=True, retain_graph=True)[0]
~\Anaconda3\lib\site-packages\torch\autograd_init_.py in grad(outputs, inputs, grad_outputs, retain_graph, create_graph, only_inputs, allow_unused)
200         retain_graph = create_graph
201
 → 202     return Variable.execution_engine.run_backward(
203         outputs, grad_outputs, retain_graph, create_graph,
204         inputs, allow_unused)
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [51126]], which is output 2 of struct torch::jit::`anonymous namespace’::DifferentiableGraphBackward, is at version 3; expected version 2 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!
]
thanks !