Thank you very much @ptrblck, you are correct that the model creates Var1 and Var2. I’ve just tested your solution of detaching the tensor and it solved the issue.
I will write a detailed destription of the problem and the solution here shortly.