Thank you for your reply. I am not totally sure I understand all the questions, but I will try my best. The code I posted is all I do so far, I am not passing the array through numpy, it goes from panda dataframe to pytorch tensor directly. I tried through numpy, too, but I am getting the same error. The machine has 30 GB of RAM. I tried the same code as above on another machine, where I can set the amount of memory to use and it fails at 30 GB there, too. If I increase it to 40 GB it seems to work, so it is clearly a memory problem. My main question is how can I get around this. I assume people training on large set (like Imagenet) would have the same problem, maybe a lot worse than me, so I thought there may be smart ways around this. As I said the data is floats, each input is a 1D tensor of length 2100 and the output is a 1 or 0. In total I have 700,000 such input and output pairs. Please let me know if I didn’t answer any of your question.