def shuffle(self): data = list(zip(self.src, self.tgt)) self.src, self.tgt = zip(*[data[i] for i in torch.randperm(len(data))])