2021年3月7日星期日

Multiply matrix with numpy

Hi that's the first question that i upload so be proud of me and skissme if i do it something wrong in the post. well i am using numpy but i want it to multiply a matrix of dimensions A(k,n) * B(m,k) who is mathematic correct. i understand that the matrix to be mult in numpy must be A(n,k) * B(k,m). but the question is how can i multiply this matrix without use this code that i seem on some places that is use 3 for, and too i want to know why i cant multiply this matrix

import numpy as np  a= np.array([[1,2,3],[2,3,4],[7,8,9]])  b = np.array([[1,2,3],[2,3,4]])  print(a.shape[0])  print(b.shape[1])  print(a@b)  print(a@b)  ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 2 is different from 3)  
https://stackoverflow.com/questions/66524167/multiply-matrix-with-numpy March 08, 2021 at 12:06PM

没有评论:

发表评论