RuntimeError: [enforce fail at CPUAllocator.cpp:64]

I am receiving the following error

This is my code

Can anybody help give me some insight as to what I am doing wrong/how to fix this? Any help would be greatly appreciated. Thank you.

If anybody else runs into this problem, I assume the problem was that the cpu instance I was using on Paperspace Gradient just didn’t have enough memory. Using the free gpu instance allowed it to run without a problem.