Imported from https://github.com/FranzHell/Pytorch-VariationalAutoEncoder