From the docs :
“Input: (N,∗,in_features) where * means any number of additional dimensions.
Output: (N,∗,out_features) where all but the last dimension are the same shape as the input.”
So with nn.Linear, you can apply a transformation on the last dimension of you input.