Thank you for your answer, I ended up solving it and, as you say, it was a matter of passing the tensors to DoubleTensor. The problem was that I thought they were already, but do to an intermediate function they weren’t. I found a good combination of batch_size and num_workers in the end. Thank you!