python numpy-维度

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010255642/article/details/83064201
x=np.array([[[1],[2]],[[3],[4]]])

x.shape
Out[109]: (2, 2, 1)

x.reshape(2,2)
Out[110]: 
array([[1, 2],
       [3, 4]])

x
Out[111]: 
array([[[1],
        [2]],

       [[3],
        [4]]])

y=x.reshape(2,2)

y
Out[113]: 
array([[1, 2],
       [3, 4]])

y.reshape(2,2,1)
Out[114]: 
array([[[1],
        [2]],

       [[3],
        [4]]])

猜你喜欢

转载自blog.csdn.net/u010255642/article/details/83064201