Skip to content
Tensorflow implementation of Hyperspherical Variational Auto-Encoders
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
hyperspherical_vae Fixed numerical errors in sampling from VonMisesFisher. Added dynamic… Jun 29, 2018
LICENSE update citation and bibtex Oct 18, 2018

Hyperspherical Variational Auto-Encoders

Tensorflow implementation of Hyperspherical Variational Auto-Encoders


This library contains a Tensorflow implementation of the hyperspherical variational auto-encoder, or S-VAE, as presented in [1]( Check also our blogpost (

  • You do not use Tensorflow? Take a look here for a pytorch implementation!



To install, run

$ python install


  • distributions: Tensorflow implementation of the von Mises-Fisher and hyperspherical Uniform distributions. Both inherit from tf.distributions.Distribution.
  • ops: Low-level operations used for computing the exponentially scaled modified Bessel function of the first kind and its derivative.
  • examples: Example code for using the library within a Tensorflow project.


Please have a look into the examples folder. We adapted our implementation to follow the structure of the recently proposed Tensorflow Distribution library, (Dillon et al, 2017).

Please cite [1] in your work when using this library in your experiments.

Sampling von Mises-Fisher

To sample the von Mises-Fisher distribution we follow the rejection sampling procedure as outlined by Ulrich, 1984. This simulation pipeline is visualised below:

blog toy1

Note that as is a scalar, this approach does not suffer from the curse of dimensionality. For the final transformation, , a Householder reflection is utilized.


For questions and comments, feel free to contact Nicola De Cao.




[1] Davidson, T. R., Falorsi, L., De Cao, N., Kipf, T.,
and Tomczak, J. M. (2018). Hyperspherical Variational
Auto-Encoders. 34th Conference on Uncertainty in Artificial Intelligence (UAI-18).

BibTeX format:

  title={Hyperspherical Variational Auto-Encoders},
  author={Davidson, Tim R. and
          Falorsi, Luca and
          De Cao, Nicola and
          Kipf, Thomas and
          Tomczak, Jakub M.},
  journal={34th Conference on Uncertainty in Artificial Intelligence (UAI-18)},
You can’t perform that action at this time.