Skip to content

Commit

Permalink
Interface to keras SGD
Browse files Browse the repository at this point in the history
  • Loading branch information
nwittler committed Jan 25, 2024
1 parent 23acf38 commit c2fa787
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions c3/libraries/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ def tf_fun():

opt_sgd = tf.keras.optimizers.SGD(learning_rate=learning_rate, momentum=momentum)

for _ in range(iters):
step_count = opt_sgd.minimize(tf_fun, [var])
print(f"epoch {step_count.numpy()}: func_value: {tf_fun()}")
for ii in range(iters):
opt_sgd.minimize(tf_fun, [var])
print(f"iter {ii}: func_value: {tf_fun()}")

result = OptimizeResult(x=var.numpy(), success=True)
return result
Expand Down

0 comments on commit c2fa787

Please sign in to comment.