The easy approach would be to print the shape of the incoming activations first and set the in_features of the first linear layer afterwards. Alternatively, you could use the Lazy* layers, which would set the input shape for you.