You can compute Hessian-Vector-Products, the trick is to pass build_graph=True to torch.autograd.grad or x.backward. Then you can use gradients in computation and y.backward or torch.autograd.grad again will do the right thing.
Best regards
Thomas