t1 = torch.tensor([1,2,3])
t2 = torch.tensor([4,5,6])
t3 = torch.tensor([7,8,9])
torch.stack((t1,t2,t3),dim=1)
Run Code Online (Sandbox Code Playgroud)
在实现 torch.stack() 时,我无法理解如何对不同的暗淡进行堆叠。这里对列进行了堆叠,但我无法理解它是如何完成的细节。处理 2-d 或 3-D 张量变得更加复杂。
tensor([[1, 4, 7],
[2, 5, 8],
[3, 6, 9]])
Run Code Online (Sandbox Code Playgroud)