All the codes are giving me a result of 0
x=torch.FloatTensor([1,2,3])
v=torch.FloatTensor([1,1,1])
x = x.detach().requires_grad_()
v = v.detach().requires_grad_()
y = x**3 - 6*x
grad_x = torch.autograd.grad(y, x, v, create_graph=True)[0]
print("Grad_x is {0}".format(grad_x))
vjp_val = grad_x
jvp_val = torch.autograd.grad(grad_x, v, v.detach(),create_graph=True)[0]
print("jvp_val is {0}".format(jvp_val))
print((vjp_val - jvp_val).norm(1))

Results
tensor([ 6., 12., 18.], grad_fn=<CloneBackward>)
Grad_x is tensor([-3.,  6., 21.], grad_fn=<AddBackward0>)
jvp_val is tensor([-3.,  6., 21.], grad_fn=<AddBackward0>)
tensor(0., grad_fn=<NormBackward0>)