Hello,
In the propagate function, for implementing the cost function we use element-wise:
cost = -np.sum(Y * np.log(A) + (1-Y) * np.log(1-A)) / m
but I couldn’t understand deeply and main reason why we used the element-wise instead of the dot product here between Y and log(A).
Just because the inner dimensions of the Y and A are not the same hence we use element-wise instead of the dot? So if the inner dimensions were the same, we can use dot interchangeably?
I went through this answer but it didn’t help me.
In general, I couldn’t find the main distinction between using the dot product in computing the dw and using element-wise in computing cost. when dot and when element-wise?
could someone help me with this?
Many thanks for considering my question.
Best Regards,
Reza.