I have encountered a problem about memory for the same code.
In gpu mode, it works fine. but when I switch to cpu, the memory consumption gradually blows up and eventually take all the memory.
What do you think might be the cause?
Thank you!