🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 13: Adam Optimizer Step Demo

ML Engineer

Builds on these lessons

Current Task

Objective

An optimizer like Adam uses computed gradients to update variables — apply_gradients() is the low-level call .fit() performs internally every step.

Task: apply one Adam optimization step to a variable and print its updated value.

index.py
import tensorflow as tf x = tf.Variable(10.0) optimizer = tf.keras.optimizers.Adam(learning_rate=0.1) with tf.GradientTape() as tape: loss = x ** 2 grads = tape.gradient(loss, [x]) optimizer.apply_gradients(zip(grads, [x])) print(x.numpy())

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview