Hey  @Federico_Pala  i think i got it why it was not working properly . I  replaced  out.backward(out) with out.backward(torch.ones(*out.size(0)) and RAM consumption is not increasing any more.
Hey could you give me any insight why passing the Variable out in backward() call was increasing the memory Consumption.