Dataloader error when update from python2.7 to python3.6

I modify the code to fit the python3.6 (it works well in python2.7) with pytorch0.3.1.post2 and encounter the following error:

RuntimeError: invalid argument 1: must be strictly positive at /opt/conda/conda-bld/pytorch_1518243271935/work/torch/lib/TH/generic/THTensorMath.c:2247

Could you post a code snippet throwing this error?

for it, (images_a, images_b) in enumerate(zip(train_loader_a,train_loader_b)):

The error happens in above line. I suppose it is caused by the dataloader, and find that other people also meet this problem but no solution.

It seems the error is thrown in randperm. Could you post the code to your Dataset and DataLoader?