made it work for autoencder