The documentation says "Submodules assigned in this way will be registered, " but does not actually say how this magical automatic registration happens. Could anyone explain?
Another and maybe related question for me is what kind of magic super(Model, self).__init__()
is doing?
Thank you – so the only way of how the submodules get registered is when an attribute is directly assigned an instance of a Module subclass.
In all other cases, e.g. assigning to a component or element of an attribute or assigning something that contains Module subclass instance, this does not work and one has to call self.add_module(...) for the submodule?