In [33]: a = np.random.randint(2, 9, (2, 3, 5))
In [34]: b = np.random.uniform(2, 3, 5)
In [35]: a.shape
Out[35]: (2, 3, 5)
In [36]: b.shape
Out[36]: (5,)
In [37]: b = np.random.uniform(2, 6, (2, 3, 5))
In [38]: a.shape
Out[38]: (2, 3, 5)
In [39]: b.shape
Out[39]: (2, 3, 5)
In [40]: concat_axis_0 = np.concatenate([a, b], axis=0) #0轴堆叠, 其它轴的shape不变
In [41]: concat_axis_0.shape
Out[41]: (4, 3, 5)
In [42]: concat_axis_1 = np.concatenate([a, b], axis=1) #1轴堆叠, 其它轴的shape不变
In [43]: concat_axis_1.shape
Out[43]: (2, 6, 5)
In [44]: concat_axis_2 = np.concatenate([a, b], axis=2) #2轴堆叠, 其它轴的shape不变
In [45]: concat_axis_2.shape
Out[45]: (2, 3, 10)
In [46]: concat_axis_2 = np.concatenate([a, b], axis=-1) #2轴堆叠, 其它轴的shape不变
In [47]: concat_axis_2.shape
Out[47]: (2, 3, 10)
torch.cat
pd.concat
https://blog.youkuaiyun.com/leviopku/article/details/82380710