将 numpy 数组从 (x,x,1) 重塑为 (x,x)
Reshape a numpy array from (x,x,1) to (x,x)
我想将一个 numpy 数组从 (32,32,1) 重塑为 (32,32) 以便我可以使用 matplotlib.pyplot.imshow()
.
绘制它的图像
我收到 matplotlib.pyplot.imshow()
的无效尺寸错误,所以我假设它需要 (32,32)。
如何重塑我的 numpy 数组来绘制图像?
x.reshape([32,32])
np.squeeze(x)
x[:,:,0]
任何一个。
我想将一个 numpy 数组从 (32,32,1) 重塑为 (32,32) 以便我可以使用 matplotlib.pyplot.imshow()
.
我收到 matplotlib.pyplot.imshow()
的无效尺寸错误,所以我假设它需要 (32,32)。
如何重塑我的 numpy 数组来绘制图像?
x.reshape([32,32])
np.squeeze(x)
x[:,:,0]
任何一个。