Counting 2,975 Big Data & Machine Learning Frameworks, Toolsets, and Examples...
Suggestion? Feedback? Tweet @stkim1

Last Commit
Jul. 16, 2018
Oct. 23, 2017

TensorFlow Probability

TensorFlow Probability is a library for probabilistic reasoning and statistical analysis in TensorFlow. As part of the TensorFlow ecosystem, TensorFlow Probability provides integration of probabilistic methods with deep networks, gradient-based inference via automatic differentiation, and scalability to large datasets and models via hardware acceleration (e.g., GPUs) and distributed computation.

Our probabilistic machine learning tools are structured as follows.

Layer 0: TensorFlow. Numerical operations. In particular, the LinearOperator class enables matrix-free implementations that can exploit special structure (diagonal, low-rank, etc.) for efficient computation. It is built and maintained by the TensorFlow Probability team and is now part of tf.linalg in core TF.

Layer 1: Statistical Building Blocks

Layer 2: Model Building

  • Edward2 (tfp.edward2): A probabilistic programming language for specifying flexible probabilistic models as programs.
  • Probabilistic Layers (tfp.layers): Neural network layers with uncertainty over the functions they represent, extending TensorFlow Layers.
  • Trainable Distributions (tfp.trainable_distributions): Probability distributions parameterized by a single Tensor, making it easy to build neural nets that output probability distributions.

Layer 3: Probabilistic Inference

  • Markov chain Monte Carlo (tfp.mcmc): Algorithms for approximating integrals via sampling. Includes Hamiltonian Monte Carlo, random-walk Metropolis-Hastings, and the ability to build custom transition kernels.
  • Variational Inference ( Algorithms for approximating integrals via optimization.
  • Optimizers (tfp.optimizer): Stochastic optimization methods, extending TensorFlow Optimizers. Includes Stochastic Gradient Langevin Dynamics.
  • Monte Carlo (tfp.monte_carlo): Tools for computing Monte Carlo expectations.

TensorFlow Probability is under active development. Interfaces may change at any time.


See tensorflow_probability/examples/ for end-to-end examples. It includes tutorial notebooks such as:

It also includes example scripts such as:


To install the latest version, run the following:

pip install --user --upgrade tfp-nightly    # depends on tensorflow (CPU-only)

TensorFlow Probability depends on a current nightly release of TensorFlow (tf-nightly); the --upgrade flag ensures you'll automatically get the latest version.

We also provide a GPU-enabled package:

pip install --user --upgrade tfp-nightly-gpu  # depends on tensorflow-gpu (GPU enabled)

Currently, TensorFlow Probability does not contain any GPU-specific code. The primary difference between these packages is that tensorflow-probability-gpu depends on a GPU-enabled version of TensorFlow.

To force a Python 3-specific install, replace pip with pip3 in the above commands. For additional installation help, guidance installing prerequisites, and (optionally) setting up virtual environments, see the TensorFlow installation guide.

You can also install from source. This requires the Bazel build system.

# sudo apt-get install bazel git python-pip  # Ubuntu; others, see above links.
git clone
cd probability
bazel build --copt=-O3 --copt=-march=native :pip_pkg
PKGDIR=$(mktemp -d)
./bazel-bin/pip_pkg $PKGDIR
pip install --user --upgrade $PKGDIR/*.whl


As part of TensorFlow, we're committed to fostering an open and welcoming environment.

  • Stack Overflow: Ask or answer technical questions.
  • GitHub: Report bugs or make feature requests.
  • TensorFlow Blog: Stay up to date on content from the TensorFlow team and best articles from the community.
  • Youtube Channel: Follow TensorFlow shows.
  • Mailing list: Stay tuned!

See the TensorFlow Community page for more details. Check out our latest publicity here:


We're eager to collaborate with you! See for a guide on how to contribute. This project adheres to TensorFlow's code of conduct. By participating, you are expected to uphold this code.


  • TensorFlow Distributions. Joshua V. Dillon, Ian Langmore, Dustin Tran, Eugene Brevdo, Srinivas Vasudevan, Dave Moore, Brian Patton, Alex Alemi, Matt Hoffman, Rif A. Saurous. arXiv preprint arXiv:1711.10604, 2017.

Latest Releases
TensorFlow Probability 0.1.0-rc1
 Jun. 16 2018
TensorFlow Probability 0.1.0-rc0
 Jun. 15 2018