Hi,
pytorch dataloader already uses multiprocessing. As gpu is asynchronous it runs in parallel if that’s you are wondering. In fact, when you set num_workers,= N, N batches will be loaded in parallel (if you have enough cpus ofc).
The problem is you want to allocate those batches on gpu inside the multiprocessing. I think that’s not possible (if i’m not wrong). But if you wanna try it’s a matter of allocating tensors into gpu inside the getitem. I’d say it will throw an error but you can try.
For sure I can tell you that you would be only saving the time gpu needs to allocate the batch into the gpu, but nothing else (if it’s not already like that).