Exercises

These exercises check the computation graph and autodiff ideas from the chapter.

Exercise: Forward value

Let x = 3, w = 2, b = 4, u = xw, and z = u + b. What is z?

Compute it first, then check your number.

Exercise: Local derivative

If u = 7x, what is du/dx?

Compute it first, then check your number.

Exercise: Chain rule

If dL/du = 6 and du/dx = 7, what is dL/dx?

Compute it first, then check your number.

Exercise: Gradient accumulation

A value receives gradient contributions 3, 5, and -1. What is the accumulated gradient?

Compute it first, then check your number.

Exercise: Stop-gradient forward value

Let x = 5 and y = x + stop_gradient(x). What is the forward value of y?

Compute it first, then check your number.

Exercise: Finite difference

Let f(x) = x^2, x = 4, and epsilon = 1. Compute [f(5) - f(3)] / 2.

Compute it first, then check your number.