Imported from https://github.com/alexbooth/Beta-VAE-Tensorflow-2.0