首页 > 其他分享 >np.expand_dims

np.expand_dims

时间:2023-03-06 22:33:24浏览次数:53  
标签:print dims shape np expand axis

import numpy as np

a = np.array([[1,2],[3,5]])

x = np.expand_dims(a, axis=0)
y = np.expand_dims(a, axis=1)
z = np.expand_dims(a, axis=2)
print(a.shape)
print(x.shape)
print(y.shape)
print(z.shape)

输出结果:

np.expand_dims_python

x:

np.expand_dims_python_02

y:

np.expand_dims_python_03

z:

np.expand_dims_python_04

参考知乎​​https://www.zhihu.com/question/265545749​

np.expand_dims_python_05


np.expand_dims_python_06

np.expand_dims_python_07

np.expand_dims_python_08

np.expand_dims_python_09

参考:

​https://blog.csdn.net/qq_40643699/article/details/107985401​


标签:print,dims,shape,np,expand,axis
From: https://blog.51cto.com/u_12074581/6104066

相关文章