Solved by Cedric_Gullentops in post #5 
              
              
                I am unsure of how to provide a minimal code snippet of my program that is able to reproduce the error since it is several hundreds of lines. However I have found the solution to my problem. 
As I first suspected it was the grad attributes of the tensors that were the problem. The size of these tens…