Dataloader size must match?

Hello,

I am using a dataloader with IMDB dataset and i get this error :

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 1 and 2 in dimension 1 at …\aten\src\TH/generic/THTensor.cpp:711

class DataProcessing(Dataset):
def init(self,data,labels,tokenizer):
self.data = data
self.tokenizer = tokenizer
self.labels = labels
def getitem(self, index):
return torch.tensor(self.tokenizer.encode(self.data.iloc[index,:].item()[:3]))
def len(self):
return self.data.shape[0]

train_sampler = RandomSampler(dp)
train_dataloader = DataLoader(dp, sampler=train_sampler, batch_size=100)

i reduced the size and now it’s always the same but i still get the error ?