# C1-W2-A2: Forward and Backward propagation - Wrong value for cost

**URL:** <https://dlai.staged-by-discourse.com/t/c1-w2-a2-forward-and-backward-propagation-wrong-value-for-cost/871866>\
**Category:** Neural Networks and Deep Learning\
**Tags:** week-module-1\
**Created:** [August 12, 2025, 4:19pm UTC](https://dlai.staged-by-discourse.com/t/c1-w2-a2-forward-and-backward-propagation-wrong-value-for-cost/871866 "2025-08-12T16:19:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [August 13, 2025, 2:04pm UTC](https://dlai.staged-by-discourse.com/t/c1-w2-a2-forward-and-backward-propagation-wrong-value-for-cost/871866/6 "2025-08-13T14:04:31Z")

</div>

> [@ruimingma94](#):
>
> As far as I’m concerned they all seem to be row vectors; or should I carry out shape.() to look at the vectors like Y and A before the dot calculation?

Sorry, but there is no general rule. Note that in a lot of cases Professor Ng has standalone vectors that are column vectors. Every time you are using a dot product, you need to check the shapes of the operands and you need to understand what the math formula is telling you to do in that case in order to know the order of the operands and whether any transposes are required or not.

[Here’s a thread](http://dlai.staged-by-discourse.com/t/week-2-how-to-decide-to-use-or-np-dot-when-calculating-formula/17467) which talks about this in more detail and discusses the important notational conventions that Professor Ng uses.

---

_[View the full topic](https://dlai.staged-by-discourse.com/t/c1-w2-a2-forward-and-backward-propagation-wrong-value-for-cost/871866)._
