Because the default way parameters are registered is by assignment as a property of a module, through nn.Module's __setattr__. If they’re in a list, __setattr__ never gets called. Instead you need to use an nn.ModuleList to hold your parameters. It also has an append method and is iterable, so you can just replace
self.scale_container = []
with
self.scale_container = nn.ModuleList()
and you should be good, at least for nonlinear. Also you can simply iterate over it, i.e.
for scale in self.scale_container:
rather than bothering with range and ii.
For network, if you’re using a module with parameters (i.e. nonlinear) you should assign it as a property in __init__, i.e. self.nonlinearity = nonlinear() or something, and then use self.nonlinearity in your forward. Otherwise again, the parameters don’t have any way to get registered.