np.squeeze():把张量中维度为1的维度去掉

import numpy as np
 
n_dim_data = np.random.rand(10,1,10,1,1)
n_dim_squeeze = np.squeeze(n_dim_data)
print(n_dim_data.shape) ## (10,1,10,1,1)
print(n_dim_squeeze.shape) ## (10,10)

你可能感兴趣的:(#,numpy,笔记,python,numpy)