I have a PyTorch tensor and use torch.utils.data.TensorDataset to make it a torch.utils.data.Dataset object. Then I throw it into a DataLoader and loop over it, yet the data I obtain is a list, but a tensor, and I don’t get yet why. Here an MWE:
import torch
data_geant_eval = torch.ones(256)
test_loader = torch.utils.data.DataLoader(
dataset=torch.utils.data.TensorDataset(data_geant_eval),
batch_size=256,
)
for (idx, data) in enumerate(test_loader):
print(type(data))
I also met this problem. And I also use Tensordataset to feed in dataloader. So you have the solution now? Data in dataloader is still a list, but I wanna a tuple, how can I do that?