class torch.utils.data.TensorDataset(data_tensor, target_tensor)

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]))
该函数将 特征向量和标签打包成一个列表。
posted @ 2021-06-20 21:46  祥瑞哈哈哈  阅读(266)  评论(0编辑  收藏  举报