I am trying to apply convolution/pooling inside data loader as follows:
def __getitem__(self, index):
        target = self.lbls[index]
        # read image and convert to PIL image
        I = openImage(self.fnArr[index]) 
        I = TF.to_pil_image(I, mode='RGB')
        # apply transformations, including totensor()
        I = self.transform(I)
        # here I need to transfer I to GPU so that I can apply pooling 
        I = I.cuda() # I am getting error here
        re = self.pool(I)

But I am getting the following error: " Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the ‘spawn’ start method".
What should I do to overcome this?