Solved by ptrblck in post #2 
              
              
                Yes, your approach should work just fine. 
The advantage of using a class is that it can hold internal attributes you would have to pass otherwise to your functional approach. 
E.g. using nn.CrossEntropyLoss, you could define the weight or reduction argument while creating an instance of this class.…