a=torch.tensor([3.0],requires_grad=True)
def sqrt(x):
  return x*x
b=sqrt(a)
print(b)
c=sqrt(b)
c.backward()
print(c.grad)

how can i see gradient of b tensor with respect c? it should be 2*x, and if b==9, gradient should be 18