第一节代码运行报错!
liyongchao911 opened this issue · 0 comments
dl_train = DataLoader(TensorDataset(torch.tensor(x_train).float(),torch.tensor(y_train).float()),
shuffle = True, batch_size = 8)
dl_valid = DataLoader(TensorDataset(torch.tensor(x_test).float(),torch.tensor(y_test).float()),
shuffle = False, batch_size = 8)
AssertionError Traceback (most recent call last)
in
----> 1 dl_train = DataLoader(TensorDataset(torch.tensor(x_train).float(),torch.tensor(y_train).float()),
2 shuffle = True, batch_size = 8)
3 dl_valid = DataLoader(TensorDataset(torch.tensor(x_valid).float(),torch.tensor(y_valid).float()),
4 shuffle = False, batch_size = 8)
~\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataset.py in init(self, *tensors)
34
35 def init(self, *tensors):
---> 36 assert all(tensors[0].size(0) == tensor.size(0) for tensor in tensors)
37 self.tensors = tensors
38
AssertionError: