You should use nn.ModuleList instead of Python lists to add your modules to NNGenerator.
This would make sure to properly register these layers and return all parameters via model.parameters().
However, if you are planning to dynamically adding new layers to the model, you would still have to either recreate the optimizer or add the new parameters to it.