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,)
上一篇:KNN算法
flatnonzero函数的用法
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M