Script error: Module has no attribute _modules

Module 'SparseSequential' has no attribute '_modules' :
  File "/home/gcy/code/spconv-master/spconv/", line 132
    def forward(self, input):
        print(888888888, self._modules)
                         ~~~~~~~~~~~~~ <--- HERE
        for module in self._modules:

NOW I have a class SparseSquential derived from nn.modulle. When I script this class, I got the error above. As we all know , the _modules is a member variable ‘OrderedDict’ in the nn.module. So how to solve it. THanks .

My environment is pytorch:1.5.0 .

Check out .modules() or .named_modules() - both return an iterator of modules in the network.