文章目录
- stack
- d = t.stack((a,), dim=0)
- d = t.stack((a,), dim=1)
- d = t.stack((a,), dim=2)
- d = t.stack((a,b), dim=0)
- d = t.stack((a,b), dim=1)
- d = t.stack((a,b), dim=2)
- d = t.stack((a,b,c), dim=0)
- d = t.stack((a,b,c), dim=1)![在这里插入图片描述](https://img-blog.csdnimg.cn/20210420141307529.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3hpYW94aWFvXzI0NDZ4dXh1,size_16,color_FFFFFF,t_70)
- d = t.stack((a,b,c), dim=2)
stack
import torch as t
a = t.arange(1, 10).reshape(3, 3)
a
b = t.arange(10, 100, 10).reshape(3, 3)
b
c = t.arange(100, 1000, 100).reshape(3, 3)
c
d = t.stack((a,), dim=0)