# Week 3 exercise 6 cost function

**URL:** <https://dlai.staged-by-discourse.com/t/week-3-exercise-6-cost-function/723602>\
**Category:** Neural Networks and Deep Learning\
**Tags:** week-module-3, coursera-platform\
**Created:** [November 16, 2024, 1:02am UTC](https://dlai.staged-by-discourse.com/t/week-3-exercise-6-cost-function/723602 "2024-11-16T01:02:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aakash\_Beri](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/aakash_beri/32/128096_2.png) [@Aakash\_Beri](https://dlai.staged-by-discourse.com/u/Aakash_Beri)\
**Post date:** [November 16, 2024, 1:02am UTC](https://dlai.staged-by-discourse.com/t/week-3-exercise-6-cost-function/723602/1 "2024-11-16T01:02:18Z")

</div>

week 3 and exercise6

_{moderator edit - solution code removed}_

I am having an error saying “ValueError: operands could not be broadcast together with shapes (4,3) (3,2)” when computing the dW1 and many errors in remaining lines too. but it is very same as given in the notebook by grader , can somebody pls help.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://dlai.staged-by-discourse.com/u/paulinpaloalto)\
**Post date:** [November 16, 2024, 1:40am UTC](https://dlai.staged-by-discourse.com/t/week-3-exercise-6-cost-function/723602/2 "2024-11-16T01:40:30Z")

</div>

That is not the correct implementation for dZ1. the operation between W2^T and dZ2 is not `np.multiply` (which is elementwise): it is a dot product or `np.dot`.

Please see [this thread](http://dlai.staged-by-discourse.com/t/week-2-how-to-decide-to-use-or-np-dot-when-calculating-formula/17467/2) for more information about the notational conventions that Prof Ng uses for the different types of multiplication.
