I have a pytorch model (custom model inherited from nn.Module).
I'm developing some architecture, for which makes sense for my task to have a list defined in the model as:
class Model(nn.Module):
def __init__(self, hparams):
super().__init__()
self.list = []
In every training step, I want to store in this list some information. Particularly, a number that I will calculate over the training step.
To be more clear:
for each training step I receive a batch of size $n$, and in the training step I update the self.list
in Model
to store $n$ values. For instance, after a first iteration with a batch size of 100, the self.list
list will contain 100 values. Every iteration, I will add 100 more to the list...
I mean, this makes sense for my task, but I'm wondering if this is "legal". Also it seems a bit weird, because the parameters of my model would increase with the training size? Because in the end, if I use 10,000 training samples, this list will hold 10,000 values. But if I use more, the list will have more. Would this be an increase in parameters? When I save this model, will the number of parameters be affected by this? That's what I'm not sure about.