Thank you   ,
As you told i tried and may be it worked, but
a = torch.randn(2,2)
a = ((a*3)/ (a-1))
a.requires_grad_(True)
b = (a * a).sum()
b.backward()
# print(b.grad)
b.retain_grad()
print(b.grad)

it prints nothing.
But when i used b.retain_grad() before b.backward()  it seems working now , although i am thinking what it is printing

b.retain_grad()
b.backward()
# print(b.grad)
print(b.grad)

prints tensor(1.) may be this is right.