Dataloader is more than 4x slower

Dataset and Dataloader classes are most appropriate with data that is accessed from your hard drive. But there are issues in Windows operating systems when setting num_workers ≠ 0.

If you can upload all of your data into ram or, better yet, onto a gpu, you can use something like this: