I have a module that stores a list of
nn.Parameters (old gradients - it’s an optimizer).
I only store a fixed number, say 100, so after a while I want to kick out the oldest.
My natural instinct is to use a python
deque, but of course that won’t work, since I need to store my parameters in a
ParameterDict for stuff like
.double() to work.
Now I wonder if I should just bite the (perhaps not that great) performance bullet of using a
ParameterList as a deque, just calling
del list at each step.
Or if I should clone
nn.ParameterList and make my own implementation using
I suppose I could also use a
ParameterDict with consecutive integers as keys…
None of the options seem ideal. Is there a best practice I should refer to?