Deep Learning Specialization week4 A1 EX 6

I am having trouble figuring out the cost function for this L-layer model.

The error I get is:
image

I am having trouble seeing what I did wrong. I have changed the positions of different numbers in the equation, changed from np.dot to np.multiply, but nothing is working. What am I doing wrong?

To multiply 2 matrics of dimensions (a,b) and (c, d) the inner dimensions must match i.e. b should equal c. Hint: To fix this, use transpose operator where applicable.

I have divided the terms to understand it better:
and it worked!

Thank you!

The 2nd term of np.sum represents the axis along which to sum. Since both your terms are scalars, use the + operator to sum the terms.
Please don’t forget to remove code from your posts.