QuCumber icon indicating copy to clipboard operation
QuCumber copied to clipboard

Possible Memory leak

Open isaacdevlugt opened this issue 6 years ago • 0 comments

In the gibbs sampling routine, the "requires_grad=True" flag in the weights and biases pollutes the routine. I ran into this problem in my multinomial RBM code. We never clear the gradient cache for just wanting to sample the RBM, so the loop over the number of gibbs steps builds and builds the cache. Can be fixed (I think) with just saying "with torch.no_grad():" then the gibbs sampling routine commences (bypasses any "requires_grad=True" and saving to cache I think).

But we might run into issues if we have this there because during training we need to sample the RBM of course, so I'm unsure what "with torch.no_grad():" will do during training since we actually need "requires_grad = True".

isaacdevlugt avatar Mar 27 '19 14:03 isaacdevlugt