Here is my code:
import torch
class Dataset(torch.utils.data.Dataset):
def __init__(self, labels):
'Initialization'
self.labels = labels
def __len__(self):
'Denotes the total number of samples'
return len(self.labels)
def __getitem__(self, index):
X = torch.load('data/' + str(index) + '.pt')
y = self.labels[index]
return X, y
training_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size = 1)
But when I do a for loop with training_dataloader on this dataset class, it returns only the label y, not the features X, even though if I print X, I can see it being printed. What am I doing wrong here?