class torch.utils.data.TensorDataset(data_tensor, target_tensor)
train_features=torch.tensor([[1.1,2.1]])
train_labels=torch.tensor([[1.1]])
print(torch.utils.data.TensorDataset(train_features,train_labels)[0])
(tensor([1.1000, 2.1000]), tensor([1.1000]))
该函数将 特征向量和标签打包成一个列表。
class torch.utils.data.TensorDataset(data_tensor, target_tensor)