Should I use Module as parameter container (with no forward method)?

I need to define a class Model that contains my model parameters, but for which it makes no sense to define a forward method. Instead, I’ll define other modules which can read the parameters from Model and which then define their forward methods.

Is it natural that Model inherits from Module in this case (even though it doesn’t implement forward)?

Inheriting from Module helps, because it means that the parameters are tracked automatically and I can compose several Model components together easily.

What do you think?

Hi,

I think you can yes. Note that you can also make this module a Submodule of your other modules that do the forward.

1 Like

If by this you mean that module A contains the model module as an attribute, then yes, that’s what I have in mind.

1 Like