Hi
If you want to be able to backprop through another backprop, you have to run the first one with create_graph=True (see the doc for more details).
Also I would recommend using autograd.grad when doing higher order derivatives as it avoid any issue with multiple backward accumulating gradients at the same place.
def grad(func, x):
    y = func(x)
    gr = autograd.grad(y, x, create_graph=True)[0]
    return gr