Solved by albanD in post #2 
              
              
                Hi, 
This function is not called because nn.Module are completely differentiated with automatic differentiation. 
If you want to be able to define both the forward and backward, you need to use an autograd.Function, but then you need to implement the full backward yourself. 
If you want to call a fu…