Error in ungraded lab

Ok, I saw, that solution in the end of file.

By the way, what is the difference between np.matmul() and *?

1 Like

Hi someone555777,

np.matmul() is for matrix multiplication, * is for element-wise multiplication. I found a nice comparison between various ways of multiplication here.

1 Like

I read it and I still have question now about differences between np.dot and np.matmul. For example, in the start of article he gave example of matmul that is not very looks like dot. As I remember, we shouldn’t multiply each of raw elements on columns of second matrix, isn’t it?

But he said in article, that they don’t have any differences basicaly :thinking:

Hi someone555777,

You can have a look at this discussion on stack overflow.

ok, so, it’s the same if less than 2 dimensions. But can you explain me what is the matmul example on the screen? It looks not the same as dot

Hi someone555777,

I am not sure which screen you mean. If you mean the example of matrix multiplication given in the first link, then the dot product of the first matrix with the second matrix is as shown, i.e. the first element of the matrix containing the dot product is equal to a11*b11+a12*b21 (and so on for the other elements), as explained here.
But maybe you mean something else?

screen on 3 messages above

Well, the matmul used in the ungraded lab is in fact a dot product. The way this works is shown in the link in my previous response.