Let me give you an example:
Let’s say layers_dims = [12288, 20, 7, 5, 1]
. This is a 4-layer model, (3 input and 1 output layer) right?
We have L = len(layer_dims)
, which is 5 in this case. But we don’t want to start the loop from 0 till 4, we want to start from 1 to 4, thus counting all the 4 layers (3 input and 1 output layer) in a loop. We do not want input layer (index = 0) to be a part of for loop.
We are initiating from 1, not 0.