A PyTorch Module organizes a neural-network component: its forward function maps inputs to outputs, while PyTorch handles backward computation unless you intervene. Standard modules live in torch.nn; custom modules can be built from tensors, Parameter, and torch.nn.functional objects, and can contain other modules. section 2.1.5
From layer to model
For d inputs and C outputs, nn.Linear(d, C) provides a linear layer with a bias. A larger model can compose layers, as in a Sequential classifier with Linear and Tanh layers, then pass the model to a training function. section 2.1.5 section 2.4.4
Figure 2.3 The Model box denotes the neural network fΘ(∙) that we want to train. This could be a small network or a very complex one. It is encapsulated into one model object with a single set of parameters Θ. The same process works for almost any network definition.
Shows a neural network encapsulated as one model object with a single set of parameters. section 2.1.5





