rasbt:

Also, the data transformation is so fast that it really doesn’t cause any bottleneck on typical dataset if you have num_workers>=4 (I benchmarked this in the past)


It doesn’t seem like the case here. I mean comparing DataLoader using full batch with simply full batch in my case without the DataLoader, in both cases same transformations. Still full batch without DataLoader is almost half the time that it takes the DataLoader with full batch, and here is where I don’t understand why so much discrepancy?



 rasbt:

randperm might suit your purpose:


Thanks this is what I’m already doing:



 kirk86:

images = images.view(images.size(0), -1)
temp = torch.cat([ images, labels.view(images.size(0), 1).to(torch.float) ], dim=1)
idx = torch.randperm(temp.nelement()) temp.view(-1)[idx].view(temp.size())
images = temp[:, :images.size(1)] labels = temp[:, -1].to(torch.long)


I dunno if there’s a more efficient way?