Parameters not automatically registered in module

I have a problem when I use dictonaries that contain parameters inside a module. Such parameters are not registered in the list of module’s parameters.
is there a quick fix for this?

e.g. inside the init of a module:

self.waggrs = {}
for rel in range(10):
 self.waggrs[rel]={'w':nn.Parameter(1.+torch.randn( 2)),'b':nn.Parameter(torch.zeros(2))}
 self.list_relations[rel]=nn.Linear(numfeatures, numrel)

model.parameters() does not contains the parameters


This seems related to List of nn.Module in a nn.Module