Avoid the side-effect of parameter auto-registering in module?

I have seen this post


My question is that
Is there any way to avoid automatically registering parameters when setting a module to another one’s attribute?
The only way I can think of is appending it to a list. What’s the common approach(workaround)?

yes appending it to a list or putting it any list like structure that’s not an nn.ModuleList should work.

Alternatively, you can override parameters() and in your custom function return a filtered set of parameters.

1 Like