The shape attribute for numpy arrays returns the dimensions of the array. If Y has n rows and m columns, then Y.shape is (n,m). So Y.shape[0] is n.
意思就是shape[0]表示的是数组的行数。
np.array是将数组转为多维数组对象
y = np.array(y)
#shape 顾名思义,就是数组的形状,几行几列 shape[0]为行数,shape[1]为列数
y.shape
#reshape 顾名思义,就是让数组变形,括号里第一个参数为行,第二个参数为列
y.reshape(1,2)
# dot 顾名思义,点,点乘,就是括号里两个矩阵相乘
np.dot(x,y)
有任何问题或建议欢迎私信或者评论区讨论~
觉得有用就点个赞吧~