Nested nn.ParameterDict

Is it possible to have nested nn.ParameterDict like nested nn.ModuleDict?If not, is there any way to implemented it?

Thank you.

No, I don’t think that’s possible as you would get this error:

TypeError: cannot assign 'torch.nn.modules.container.ParameterDict' object to parameter 'b' (torch.nn.Parameter or None required)


p1 = nn.ParameterDict({'a': nn.Parameter(torch.randn(1)),
                       'b': nn.ParameterDict({'ba': nn.Parameter(torch.randn(1))})})