@ptrblck thanks! yes yesterday evening made the this change and it help a lot. And now it the memory allocation stays stable.
But now I have another odd problem. I still don’t understand what exactly overloads the memory and what doesn’t. For example: I do a simple difference between two tensor and it allocates so much memory that it breaks. image1054×186 42.3 KB