# Week 4, Assessment-1, Exercise, L-Model\_Backward

**URL:** <https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [January 21, 2022, 10:19am UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371 "2022-01-21T10:19:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAMRIDH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SAMRIDH\_AGARWAL](https://community.deeplearning.ai/u/SAMRIDH_AGARWAL)\
**Post date:** [January 21, 2022, 10:19am UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/1 "2022-01-21T10:19:18Z")

</div>

I can’t understand where I am going wrong can someone please clear this up

 ![eror](https://global.discourse-cdn.com/dlai/original/2X/6/67009f8e67526d93b0887e797e152c470a56c904.png)

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [January 21, 2022, 11:10am UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/2 "2022-01-21T11:10:23Z")

</div>

Does this help? [Course1 Week4 Exercise9](https://community.deeplearning.ai/t/course1-week4-exercise9/89280)

---

<div class="post-metadata">

**Author:** ![SAMRIDH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SAMRIDH\_AGARWAL](https://community.deeplearning.ai/u/SAMRIDH_AGARWAL)\
**Post date:** [January 21, 2022, 1:11pm UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/3 "2022-01-21T13:11:43Z")

</div>

I did calculate dAL manually tho

---

<div class="post-metadata">

**Author:** ![SAMRIDH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SAMRIDH\_AGARWAL](https://community.deeplearning.ai/u/SAMRIDH_AGARWAL)\
**Post date:** [January 21, 2022, 3:12pm UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/4 "2022-01-21T15:12:53Z")

</div>

It’s not working in EX9 but when I call the same function in EX10 it passes all test cases

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [January 21, 2022, 4:34pm UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/5 "2022-01-21T16:34:36Z")

</div>

In the image you show of the error, we can’t see what the arguments to _linear\_activation\_backward_ are, but I think that’s where the error is. The _grads_ values on the LHS of the assignment will get created, so they can’t throw that _KeyError_. There should be no case in which _dA0_ is the input, right? So that means one of two things:

1. Your loop logic is wrong and you’re running the loop one too many times. But they gave that to you, right?
2. The index expression for _grads_ in the arguments to that function is incorrect. When you run _linear\_activation\_backward_ for layer l, the input is dA^{[l]} and the output is dA^{[l-1]}, right? But remember how indexing works in python: it is zero-based. So the l loop index is not actually the layer number: it is one less than the actual layer number.

Have a look at those two issues and see if that sheds any light.

---

<div class="post-metadata">

**Author:** ![SAMRIDH\_AGARWAL](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SAMRIDH\_AGARWAL](https://community.deeplearning.ai/u/SAMRIDH_AGARWAL)\
**Post date:** [January 22, 2022, 4:55am UTC](https://community.deeplearning.ai/t/week-4-assessment-1-exercise-l-model-backward/89371/6 "2022-01-22T04:55:22Z")

</div>

Yeah I was the second one, thanks for the help 🙂
