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,)
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,)
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。