dmadeka1:

@alexis-jacq I need to access the intermediate data… Can I do that in your implementation?


In that case your approach seems simpler. You can even do:
encoder = nn.Sequential(nn.Linear(782,32), nn.Sigmoid())
decoder = nn.Sequential(nn.Linear(32,732), nn.Sigmoid())
autoencoder = nn.Sequential(encoder, decoder)