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,)
本文共 259 字,大约阅读时间需要 1 分钟。
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,)
转载于:https://www.cnblogs.com/hezhiyao/p/7833867.html