Based on the error message it seems your input data has 20 elements while you are expecting samples with 784
features. If your inputs are expected to have 20
features only, change the in_features
value of your first linear layer to 20
too.
1 Like