import numpy as np
x = np.arange(9).reshape(1,3,3)print'Array X:'print x
print'\n'
y = np.squeeze(x)print'Array Y:'print y
print'\n'print'The shapes of X and Y array:'print x.shape, y.shape
Python
它的输出如下:
Array X:[[[012][345][678]]]
Array Y:[[012][345][678]]
The shapes of X and Y array:(1,3,3)(3,3)