Assume we have y as a function of x, y = f(x), and z as a function of y, z = g(y).
How can I compute the gradient w.r.t. y first (dz/dy, use this to do something else), and then compute the gradients w.r.t. x (dy/dx)?