.named_modules() will return the name and module recursively for the complete model.
If you want to just register specific modules, such as nn.Conv2d but not e.g. BottleNeck or other custom modules, you could use a condition to check for the module via if isinstance().