How to clear CPU memory after training (no CUDA)

Thanks for the example, but I explicitly said that I’m running on CPU, not GPU, so I don’t see how the calls to torch.cuda will affect anything. Is there an equivalent call to clear the CPU cache (assuming, quite possibly incorrectly, that this is what I need)? Because otherwise, this seems to be qualitatively the same as my original scenario: again, training is already encapsulated in a function call, followed by gc.collect(). The memory just isn’t cleared afterwards.