Solved by mscipio in post #7 
              
              
                Thank you sooo much for your time and effort! 
I was reading about grid_sample right when I got the notification about your message! ^^ 
This version of the model (teeny tiny change wrt to your suggestion) seems to work (and converges super fast!!: 
def kmodel(p,t,Cp,device=0):
    torch.autograd.se…