Solved by InnovArul in post #2 
              
              
                Yes, you are right, that in this example, it doesn’t matter for the training loop if the function is defined as  LegendrePolynomial3.apply or just a subroutine P3. This is a simple example to show how to define a custom instantiation of autograd.Function. Note that, the elementary operators involve…