02-adam-single-step computes one Adam update. Training repeats that update many times, and the moments must carry over from one step to the next. This question wraps the single step in the loop that training actually runs, then uses it to minimize a simple function you can check by eye: f(x) = x², whose gradient is 2x and whose minimum is at 0.
Implement adam_minimize(grad_fn, theta0, steps, lr, beta1, beta2, eps). It runs steps Adam updates starting from theta0 and returns the full trajectory: the starting value followed by the value after each update. The signature and docstring are already in the editor.
steps + 1.grad_fn takes the current theta and returns the gradient at that point.Keep m and v as variables outside the loop, initialized to zeros the same shape as theta. Update them every iteration.
Inside the loop, the step counter t starts at 1, not 0, because bias correction divides by 1 - beta**t.
No results yet
Run your code to check it against the examples, or submit to run every test.