📜  列表到张量 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:58.841000             🧑  作者: Mango

代码示例2
l = list(torch.tensor([1,2,3]))
print(l)
>>>[tensor(1), tensor(2), tensor(3)]
k = torch.stack(l)
print(k)
>>>tensor([1, 2, 3])