Autoencoder_RuntimeError: shape '[-1, 784]' is invalid for input of size 20

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