import numpy as np
x
= np.array([[[0], [1], [2]]]) print(x) """
x=
[[[0] [1] [2]]] """ print(x.shape) # (1, 3, 1) x1 = np.squeeze(x) # 从数组的形状中删除单维条目,即把shape中为1的维度去掉

print(x1) # [0 1 2] print(x1.shape) # (3,)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-02-21
猜你喜欢
  • 2022-01-20
  • 2022-12-23
  • 2021-11-20
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案