How did you define x_train and y_train?
Using torch.tensors should work:
x_train = torch.randn(10, 3, 24, 24)
y_train = torch.empty(10, dtype=torch.long).random_(0, 10)

dataset = TensorDataset(x_train, y_train)
x, y = dataset[0]