What are dense CPU tensor?

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

Since your tensors are already CUDATensors, you cannot use pin_memory=True (this will use pinned host memory for fast data transfer).
The error message points rather to CPU tensors (with the additional requirement that they should be dense, not sparse).