Saving model that contains list of module

this is my model:

def __init__(self, features, num_classes=8, init_weights=True):
    super(VGG, self).__init__()
    self.features = features
    self.roiNum = 6
    self.roi_pool = _RoIPooling(5,5,1.0/32.0)
    self.rois_classifiers =   []
    classifier = nn.Sequential(
        nn.Linear(512 * 5 * 5, 512),
        nn.Linear(512, 512),
        nn.Linear(512, num_classes),
    for i in range(self.roiNum):

    if init_weights:

when i saved the model, it only saves self.feautures and self.roi_pool parameters. self.rois_classifiers parameters are not saved. Also when i print the model, again it just printed features and roi_pool layers, not rois_classifier layers. However, when i print model.rois_classifiers, everything is fine.

What is the problem here?

You would have to use nn.ModuleList instead of a Python list for self.roi_classifiers to properly register them as submodules.
Inside a module, all directly assigned nn.Modules and nn.Parameters will be registered.
Tensors, which should not be trained, can be registered as buffers via self.register_buffer.