Cannot iterate over train_dl where dataset is moved to GPU.
train_dl=  DataLoader(dataset, batch_size, sampler=train_sampler, pin_memory=True)
working over MNIST data
for images,labels in train_dl:
    outputs=model(images)
    loss=F.cross_entropy(outputs,labels)
    print("loss",loss.item())
    break
    
print(outputs.shape)
print(outputs[:10].data)

RuntimeError: cannot pin ‘torch.cuda.ByteTensor’ only dense CPU tensors can be pinned