Hi,
I am trying to create a dataloader that will return batches of input data that doesn’t have target data.
Here’s what I am doing:
torch_input = torch.from_numpy(x_train)
torch_target = torch.from_numpy(y_train)

ds_x = torch.utils.data.TensorDataset(torch_input)
ds_y = torch.utils.data.TensorDataset(torch_target)

train_loader = torch.utils.data.DataLoader(ds_x, batch_size=128, shuffle=False)
target_loader = torch.utils.data.DataLoader(ds_y, batch_size=128, shuffle=False)


I do this because my case study assumes that the train data (x_train) and their corresponding labels (y_train) do not exist on the same device.
However, the above loaders both return lists, not Tensors, and therefore the training always fails.
For illustration purposes: grabing a single batch and printing its type returns a list:
x= next(iter(train_loader))
print(type(x))

I found out that I can index x, as x[0] to access the batch as Tensors. However, I would like to know how to do this correctly (i.e., create dataloaders from x variables, without their target).