ABSTRACT

The linear part in the regression network was implemented as multiplication by a matrix – the weight matrix – and addition of a vector. With operations like that, results inevitably depend on the actual values stored in the respective tensors. Put differently, the operation is stateful. The single call triggered a complete forward pass through the network. Analogously, calling backward() will back-propagate through all the layers. At this point, you may feel like you'd like to rewrite last chapter's neural network using modules. Feel free to do so! Or maybe wait until, in the next chapter, we'll have learned about optimizers, and built-in loss functions. Once we're done, we'll return to our two examples, function minimization and the regression network. Then, we'll be removing all do-it-yourself pieces rendered superfluous by torch.