Hello,
I have an MLP with a particular structure. I would like to share weights between the units of the same layer and between layers as depicted in the following figure :

MLPl861×521 11.9 KB

How can l design such an MLP and do l need a custom  backward procedure or l can use the standard one in pytorch ?
@albanD
Thank you for your help.