autoencoder ported from matlab to python