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.
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.
I hope this clarifies.