numpy扩维方法expand_dims简单使用
x原先为1维(只有轴axis=0)的数组,使用expand_dims扩展出1维(扩展出轴axis=1)
>>> x = np.array([1, 2])
>>> x.shape
(2,)
>>> x = np.expand_dims(x, axis=1)
>>> x
array([[1],
[2]])
>>> x.shape
(2, 1)
标签:扩维,dims,shape,numpy,expand,axis
来源: https://blog.csdn.net/phdongou/article/details/114754425