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)
np.squeeze():把张量中维度为1的维度去掉
最新推荐文章于 2023-06-24 14:35:33 发布