# Week1\_Assignment2\_Dinasaur\_Names

**URL:** <https://community.deeplearning.ai/t/week1-assignment2-dinasaur-names/42591>\
**Category:** Sequence Models\
**Tags:** coursera-platform\
**Created:** [September 27, 2021, 1:22pm UTC](https://community.deeplearning.ai/t/week1-assignment2-dinasaur-names/42591 "2021-09-27T13:22:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhanvizala](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jhanvizala](https://community.deeplearning.ai/u/jhanvizala)\
**Post date:** [September 27, 2021, 1:22pm UTC](https://community.deeplearning.ai/t/week1-assignment2-dinasaur-names/42591/1 "2021-09-27T13:22:00Z")

</div>

In the given assignment in function “model”, I am unable to understand how parameters are updating. the optimisation method return loss, gradients and a\_prev, but nowhere updated parameters are returned to be used for next iteration. Also parameters from “model” method are returned which would only have parameters with initialised value. Need help to understand this confusion and flow.

---

<div class="post-metadata">

**Author:** ![reinoudbosch](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@reinoudbosch](https://community.deeplearning.ai/u/reinoudbosch)\
**Post date:** [September 27, 2021, 2:21pm UTC](https://community.deeplearning.ai/t/week1-assignment2-dinasaur-names/42591/2 "2021-09-27T14:21:14Z")

</div>

Hi jhanvizala,

The parameters dictionary is passed to the optimize function. The optimize function performs forward and backward propagation, calculating the gradients. These gradients are passed to the function update\_parameters, which updates the values of the parameters. As parameters is a dictionary, these changes are retained in the model function. This is a result of ‘call by sharing’ / ‘call by object reference’ in python as explained [here](https://stackoverflow.com/questions/15078519/python-dictionary-passed-as-an-input-to-a-function-acts-like-a-global-in-that-fu).

I hope this clarifies.
