In PyTorch, forward defines how a module transforms inputs into outputs. A model subclasses torch.nn.Module, organizes layers in __init__, and implements forward to pass input data through those layers. section 8.5 section 10.6.1
Calling a model such as nn(X) invokes forward automatically. With torch.nn.Sequential, the input moves through each linear, activation, or convolutional layer in order, producing the prediction or feature output. section 8.5 section 10.6.1
Regression model
A two-layer demand-prediction network defines forward as `return self.model(X)`. Its Sequential model applies two Linear layers with Sigmoid activations and then a final Linear layer; training calls `y_out = nn(X)` before calculating MSE loss. section 8.5
Convolutional model
A sample CNN defines `forward(self, x)` by passing `x` to `self.nn`, a Sequential container of Conv2d layers and intervening layers, then returning the result. section 10.6.1

