Hi!
I’ve just only started with Pytorch. I’ve got a question about the “Defining New Autograd Function” section of one of the first tutorials in 1.7.1 docs:
  
      pytorch.org
  
  
    

Learning PyTorch with Examples — PyTorch Tutorials 1.7.1 documentation 3



  
  
    
    
  
  


This section explains how to define custom forward and backward methods, which is nice, but the presented definition doesn’t seem to connect with the training in the same example: Do I understand correctly that it doesn’t matter for the training loop in this section that the P3 function is defined  as LegendrePolynomial3.apply rather than simply as
def P3(x):
    return 0.5 * (5 * x ** 3 - 3 * x)

?
If so, what is the advantage here of the approach with inheriting from torch.autograd.Function?