I would like to connect each nn.Module in a model to its named parent.
class AddBlock(nn.Module):
    def forward(self, x, y):
        return x+y

class multi_inp(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3,32,kernel_size=3)
        self.add = AddBlock()
    def forward(self, x, y):
        return self.conv(self.add(x,y))

a = torch.rand(3,128,128)
b = torch.rand(3,128,128)
model = multi_inp()

using the flowing:
 for n,m in model.named_modules():
     if n:
         print(n,m)

prints:

conv Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1))
add AddBlock()

I would also like to get another column stating a list of named modules for each node
module-name | parents | module
=========== | ======= | ======
conv        |  None   |  Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1))
add         | [conv]  |  AddBlock()