天天看點

numpy的升維和降維

numpy的升維

a = np.array([1,2])
b = np.expand_dims(a, axis=1)
           

numpy的降維

a = np.array([[1],[2]])
b = np.squeeze(a)