# Week 4 Exercise 9 L\_model\_backward 1 test failed

**URL:** <https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [February 5, 2022, 8:23am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483 "2022-02-05T08:23:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abz](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Abz](https://community.deeplearning.ai/u/Abz)\
**Post date:** [February 5, 2022, 8:23am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/1 "2022-02-05T08:23:14Z")

</div>

values are not matching to expected values  
I checked for hard coding found none.

## dA0 = [[0. 0.12853824] [0. -0.08041233] [0. -0.07888325] [0. -0.18221184]] dA1 = [[-0.41311681 -0.10826111] [0.45350638 0.11884557] [-0.0532252 -0.01394816]] dW1 = [[0.10087189 0.0192033 0.03393989 0.02583208] [0. 0. 0. 0.] [0.01299615 0.00247412 0.00437275 0.00332816]] dW2 = [[0.33288923 -0.16886813 -0.53686918]] db1 = [[-0.05413055] [0.] [-0.00697408]] db2 = [[0.25460995]] Error: Wrong output for variable dA1. Error: Wrong output for variable dW2. Error: Wrong output for variable db2. Error: Wrong output for variable dA0. Error: Wrong output for variable dW1. Error: Wrong output for variable db1. 2 Tests passed 1 Tests failed

AssertionError Traceback (most recent call last)  
 in   
9 print("db2 = " + str(grads[‘db2’]))  
10  
—\> 11 L\_model\_backward\_test(L\_model\_backward)

~/work/release/W4A1/public\_tests.py in L\_model\_backward\_test(target)  
442 ]  
443  
 → 444 multiple\_test(test\_cases, target)  
445  
446 def update\_parameters\_test(target):

~/work/release/W4A1/test\_utils.py in multiple\_test(test\_cases, target)  
140 print(‘\033[92m’, success," Tests passed")  
141 print(‘\033[91m’, len(test\_cases) - success, " Tests failed")  
 → 142 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target. **name** ))  
143

AssertionError: Not all tests were passed for L\_model\_backward. Check your equations and avoid using global variables inside the function.

---

<div class="post-metadata">

**Author:** ![Rashmi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rashmi/32/17812_2.png) [@Rashmi](https://community.deeplearning.ai/u/Rashmi)\
**Post date:** [February 5, 2022, 9:36am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/2 "2022-02-05T09:36:57Z")

</div>

Hi @Abz, you are hard-coding the values somewhere in your equations instead of using the parameters to pass the functions. This fails the assertions for value comparisons when different input parameters are provided.

---

<div class="post-metadata">

**Author:** ![Abz](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Abz](https://community.deeplearning.ai/u/Abz)\
**Post date:** [February 5, 2022, 2:22pm UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/3 "2022-02-05T14:22:44Z")

</div>

I have checked the code multiple times can’t find any hard coding

---

<div class="post-metadata">

**Author:** ![Rashmi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rashmi/32/17812_2.png) [@Rashmi](https://community.deeplearning.ai/u/Rashmi)\
**Post date:** [February 5, 2022, 2:45pm UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/4 "2022-02-05T14:45:47Z")

</div>

Okay, share you code in a private message if the asked things do not give you the proper result.  
First, save your work and try refreshing your page. If that’s not the case, go to kernel—\> click restart and clear output, then save your work. Run all the cells from the beginning through shift+enter.

---

<div class="post-metadata">

**Author:** ![Rashmi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rashmi/32/17812_2.png) [@Rashmi](https://community.deeplearning.ai/u/Rashmi)\
**Post date:** [February 5, 2022, 3:20pm UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/5 "2022-02-05T15:20:32Z")

</div>

@Abz, yes, I went through your codes and it seems you are not calling the functions right for dAL above, while initializing the backpropagation. Check your equations and the signs you are using.

Additionally, look at the layer you are calling for to pass the functions in the linear activation backward. AL, isn’t appropriate.

---

<div class="post-metadata">

**Author:** ![Rashmi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rashmi/32/17812_2.png) [@Rashmi](https://community.deeplearning.ai/u/Rashmi)\
**Post date:** [February 7, 2022, 10:14am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/6 "2022-02-07T10:14:45Z")

</div>

@Abz, was your problem solved? Do you need further help with the same assignment?

---

<div class="post-metadata">

**Author:** ![Abz](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Abz](https://community.deeplearning.ai/u/Abz)\
**Post date:** [February 7, 2022, 10:45am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/7 "2022-02-07T10:45:40Z")

</div>

Yeah Rashmi, the problem is solved I marked your suggestion as solution too.  
Thanks

---

<div class="post-metadata">

**Author:** ![Rashmi](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rashmi/32/17812_2.png) [@Rashmi](https://community.deeplearning.ai/u/Rashmi)\
**Post date:** [February 7, 2022, 10:49am UTC](https://community.deeplearning.ai/t/week-4-exercise-9-l-model-backward-1-test-failed/95483/8 "2022-02-07T10:49:28Z")

</div>

Okay, that’s great !
