Imported from https://github.com/adityakumarakash/VariationalAutoEncoders