resize(size[::-1])解析

a3 = np.random.normal(2, 6, (3, 2))
size = (4, 5)
b3 = a3.resize(size[::-1])#resize是原位操作,直接将原来的a3拉成一维,
#再填充成5行4列,还在a3里,无返回值,所以b3是none
print(a3, b3)
[[ 9.17528213 11.45083687  7.14082812 12.43437843]
 [-3.05177425  0.19675489  0.          0.        ]
 [ 0.          0.          0.          0.        ]
 [ 0.          0.          0.          0.        ]
 [ 0.          0.          0.          0.        ]] None
size[::-1]#这是将size的两个数倒过来
©️2020 CSDN 皮肤主题: 点我我会动 设计师:上身试试 返回首页