Hello,
The following code replace a number (with probability corrupt_prob) of true labels in the training (or test) data with random labels:
        labels = np.array(self.train_labels if self.train else self.test_labels)
        np.random.seed(12345)
        mask = np.random.rand(len(labels)) <= corrupt_prob
        rnd_labels = np.random.choice(self.n_classes, mask.sum())
        labels[mask] = rnd_labels

In PyTorch 0.2 it gave me the following error:

TypeError: len() of unsized object

The type of labels is [torch.LongTensor of size 60000].
Could anybody help me to fix this please?
Thank you in advance for your help!