with one input data x1 and one label y we can do in this way:
total_nb = 100
x1_np = np.random.randn(total_nb, 20)
x2_np = np.random.randn(total_nb, 30)
y_np = np.random.randn(total_nb, 10)
x1 = torch.from_numpy(x1_np)
x2 = torch.from_numpy(x2_np)
y = torch.from_numpy(y_np)
dataset = Data.TensorDataset(data_tensor=x1, target_tensor=y)
data_loader = Data.DataLoader(dataset, batch_size=10, shuffle=True)
for i, j in data_loader:
print(i.size(), j.size())
But how to do with two input data x1,x2 and one label y:
dataset = Data.TensorDataset(data_tensor=(x1, x2), target_tensor=y)
In this way is wrong…