what is Pytorch's add_module()?
I stumbled upon the method add_module() in a Pytorch model.
The doc only states

Adds a child module to the current module.
The module can be accessed as an attribute using the given name.

I don't understand what &quot;adding a child module&quot; means.
How is it different from just setting a pointer to the other module using self._other module = other_module?
What are the nuances?

As mentioned here: https://discuss.pytorch.org/t/when-to-use-add-module-function/10534
In general, you won’t need to call add_module. One potential use case is the following:
class Net(nn.Module):
    def __init__(self):
    super(Net, self).__init__()
        modules = [...]  # some list of modules
        for module in modules:
            self.add_module(...)

