Skip to content

Commit 7a2d312

Browse files
authored
Update Optimization methods.py
fixed bug in adam optimizer
1 parent b3257f8 commit 7a2d312

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

py/Optimization methods.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,8 @@ def update_parameters_with_adam(parameters, grads, v, s, t, learning_rate = 0.01
754754

755755
# Moving average of the squared gradients. Inputs: "s, grads, beta2". Output: "s".
756756
### START CODE HERE ### (approx. 2 lines)
757-
s["dW" + str(l+1)] = beta2 * s["dW" + str(l+1)] + (1 - beta2) * grads['dW' + str(l+1)] * grads['dW' + str(l+1)]
758-
s["db" + str(l+1)] = beta2 * s["db" + str(l+1)] + (1 - beta2) * grads['db' + str(l+1)] * grads['db' + str(l+1)]
757+
s["dW" + str(l+1)] = beta1 * s["dW" + str(l+1)] + (1 - beta2) * grads['dW' + str(l+1)] * grads['dW' + str(l+1)]
758+
s["db" + str(l+1)] = beta1 * s["db" + str(l+1)] + (1 - beta2) * grads['db' + str(l+1)] * grads['db' + str(l+1)]
759759
### END CODE HERE ###
760760

761761
# Compute bias-corrected second raw moment estimate. Inputs: "s, beta2, t". Output: "s_corrected".

0 commit comments

Comments
 (0)