I want to achieve the following in the dataloader (in the getitem method):
Converting loaded data to a tensor on the GPU, and using the GPU to perform some processing on the tensor. When I set num_workers>0, I get the following error:
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the ‘spawn’ start method
I am wondering if there is an established method to perform GPU processing in the dataloader with num_workers>0