DataLoader not returning Tensor

Here is my code:

import torch
class Dataset(
  def __init__(self, labels):
        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 =, 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?

Can you also post your training loop.