Numpy.array中的shape

numpy 創建的數組都有一個shape屬性,它是一個元組,返回各個維度的維數。有時候我們可能需要知道某一維的特定維數。 一維 二維 >>> import numpy as np >>> y = np.array([[1,2,3],[4,5,6]]) >>> print(y) [[1 2 3] [4 5 6]] >>> print(y.shape) (2, 3) >>> print(y.shap
相關文章
相關標籤/搜索