Well, that worked for me in a similar situation. And was easier than tracking non-
collectable tensors.

I’m already wrapping the individual training calls in a function; could you post an example of what you did differently?

one other possibility here is that you have deleted all tensors, but heap size (=used memory as seen from outside) remained unchanged, i.e. buffered for further allocations.

I considered this, but the kernel still crashes, so even if top is misleading me, it seems the memory is still not available.