Stacking Linear Layers
From input through hidden to output.
One Layer, One Transform
A single nn.Linear layer maps inputs to outputs with a weighted sum plus a bias. It reshapes data from one size to another.
layer = nn.Linear(in_features=4, out_features=8)Input to Hidden
Your first layer takes the raw input features and projects them into a hidden space, often a larger or smaller width.
self.fc1 = nn.Linear(4, 16) # 4 inputs -> 16 hidden