Python np.newaxis
np.newaxis的功能是插入新維度,看下面的例子: a=np.array([1,2,3,4,5])print a.shape print a 輸出結果 (5,)[1 2 3 4 5] 可以看出a是一個一維數組, x_data=np.linspace(-1,1,300)[:,np.newaxis ...
np.newaxis的功能是插入新維度,看下面的例子: a=np.array([1,2,3,4,5])print a.shape print a 輸出結果 (5,)[1 2 3 4 5] 可以看出a是一個一維數組, x_data=np.linspace(-1,1,300)[:,np.newaxis ...