一直想不明白,在1维2维的是怎么且tensor的,画个图还好一点.
举个栗子:
a = torch.tensor([1,2,3,4,5,6,7,8])
b=a.view([2,2,2])
print(b)
![在这里插入图片描述](https://img-blog.csdnimg.cn/4c1242c84d7a49f798962e13ffe8aa22.png)
c=torch.unbind(b,0)
print(c)
![在这里插入图片描述](https://img-blog.csdnimg.cn/6933d5d7308c4cec9d0c6c1a6bc30485.png)
c=torch.unbind(b,1)
print(c)
![在这里插入图片描述](https://img-blog.csdnimg.cn/800fea0338004bf1b698f3c8a751459e.png)
c=torch.unbind(b,2)
print(c)
![在这里插入图片描述](https://img-blog.csdnimg.cn/a878ee106dea4b0a88d60fee660451dc.png)
李姐
看下面图也可,其实就是,去掉一维度之后,就自动的从当前最低的维度开始,元素一个一个的吸附,组团,然后再到更高层次的一个维度去.
![在这里插入图片描述](https://img-blog.csdnimg.cn/a459a3cc7cf84e82965f26c4dca3f94a.png)