Imported from https://github.com/erickrf/autoencoder