At 4:10 Andrew writes;
a3 = np.multiply(a3, d3)
however, shouldn’t this be;
a3 = np.multiply(a3, d3.T)
as when multiplying 2 matrices a and b, the number of columns in a should equal the number of rows in b.
At 4:10 Andrew writes;
a3 = np.multiply(a3, d3)
however, shouldn’t this be;
a3 = np.multiply(a3, d3.T)
as when multiplying 2 matrices a and b, the number of columns in a should equal the number of rows in b.
Just checked it out in Python and it works. so I guess Python sorts out the shape of each matrix automatically before perofrming the computation.
Dear @ai_is_cool,
Yes you are right. Can you please provide the dimensions of a3 and d3?
Hi @Girijesh,
In the video both a3 and d3 have the same dimensions. But I have done some testing in Python3 and for any two 2-dimensional matrices;
a and b
np.dot(a, b)
equals;
np.matmul(a, b)
and
np.multiply(a, b)
is a differemnt operation and is the element-wise multiplication of;
a and b
which is of course a different matrix result from the previous two operations.
So, there is no mistake in Andrew’s lesson here, although there is a little bit of unfairness in his lectures as there is an implied assumption that the student should know NumPy.
Well, numpy was introduced in DLS Course 1 and we’ve been using it ever since. But you may be right that this might be the first time that he has explicitly used np.multiply. Normally he uses * to mean “elementwise multiply”. Here’s a thread about his notation for the two completely different types of matrix multiplication.