To make experiments require minimal code changes, I have multiple
Modules that obey the exact same
forward call. Let’s call these
Though they all obey the same
forward call, each can be constructed with different arguments, since each has different options. In this case, how can we create another Module that uses any pair of these modules, so say
C, or whatever?
ACModule, etc. Would lead to tons of boilerplate + other repeated code.
class HigherLevelModule(torch.nn.Module): def __init__(self, Module1, Module2): self.module1 = Module1(...) ...
Bad option because
Module2 can be constructed with module-specific arguments.
class HigherLevelModule(torch.nn.Module): def __init__(self, module1, module2): self.module1 = module1 ...
This seems okay but I don’t see this pattern anywhere in PyTorch.
Will Option 3 break any of the underlying
Module functionality? And in either case is there a better way to do this?
Edit: Note that each module has its own parameters.