Solved by albanD in post #2 
              
              
                Hi, 
You should make your custom module an actuall independent nn.Module. And that will solve your issues  
Instantiate it in the __init__  and use it in the forward.