AttributeError: cannot assign parameter before Module.init() call
I don’t have an specific use case for this… I am implementing a ScriptModule wrapper for R’s implementation of torch and wanted to know if this is expected to wok.
I don’t think this would be a supported use case, since the already traced model won’t have a chance to use the newly registered parameter afterwards.
In the case that this parameter is indeed used in the forward (but not registered yet), tracing would raise an error due to the usage of undefined parameters. On the other hand, if this parameter is never used in the forward, registering it afterwards won’t change anything, so I assume the error is expected.