This repository contains an implementation of the sinkhorn algorithm (1) in TensorFlow so that it can differentiated through.
tf_wasserstein.py
contains the necessary tensorflow functions, notably the functionsinkhorn_loss
that computes the sinkhorn distanceswiss_roll_demo.ipynb
contains an example use of the sinkhorn_loss, implementing a sinkhorn autoencoder (2) on the swiss roll dataset
tf_wasserstein.py
requires TensorFlow 1.1 or greater and all dependencies thereinswiss_roll_demo.ipynb
uses TensorFlow 2 and matplotlib
- Cuturi, Marco. "Sinkhorn distances: Lightspeed computation of optimal transport." Advances in neural information processing systems. (2013). http://papers.nips.cc/paper/4927-sinkhorn-distances-lightspeed-computation-of-optimal-transport
- Patrini, Giorgio, et al. "Sinkhorn autoencoders." arXiv preprint arXiv:1810.01118 (2018). https://arxiv.org/abs/1810.01118