NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #4946 most downloaded on PyPI
A Python library for probabilistic modeling and inference
Last release today
03 Oct 2026
Release timing varies
gaps range from 6 weeks to 2.3 years
Nearly every release is documented
notes for 35 of 37 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
37 releases · first in 2017
Fix pyro parameter nodes not showing up in graph of pyro deterministic nodes [bugfix] by @BenZickel in #3378
pyro.util.py by @ordabayevy in #3393log1p in examples/scanvi/scanvi.py by @kit1980 in #3397energy_score_empirical in order to reduce memory consumption by @BenZickel in #3402IndepMessenger.__iter__ type annotation by @ordabayevy in #3406Full Changelog: 1.9.1...1.9.2
One column per quarter.
Stable.log_prob() is now implemented and differentiable by BenZickel in #3369 , #3370
Stable.log_prob() is now implemented and differentiable by BenZickel in #3369, #3370pyro.nn.dense_nn and pyro.nn.auto_reg_nn by @ordabayevy in #3342Full Changelog: 1.9.0...1.9.1
Type hints are now available in some parts of Pyro, thanks to @ordabayevy . Please let us know about any issues. We welcome help adding type hints to
param_store.py type hints by @ordabayevy in #3271pyro.poutine.handlers by @ordabayevy in #3283functools.wraps to preserve handler signature by @ordabayevy in #3287pyro.poutine.runtime by @ordabayevy in #3288pyro.poutine.messenger by @ordabayevy in #3290pyro.primitives & poutine.block_messenger by @ordabayevy in #3292Trace, TraceMessenger, & pyro.poutine.guide by @ordabayevy in #3299gate & gate_logits in ZeroInflatedDistribution by @ordabayevy in #3303warn_unreachable=True by @ordabayevy in #3312Full Changelog: 1.8.6...1.9.0
Reenable support for PyTorch 1.11 (after Pyro's 1.8.5 release had narrowly required torch>=2.0)
ProvenanceTensor to use pytree by @ordabayevy in #3223torch>=1.11.0 by @francois-rozet in #3242Full Changelog: 1.8.5...1.8.6
Deprecate CorrLCholeskyTransform in favor of upstream CorrCholeskyTransform by @ordabayevy in #3199
This release includes a number of fixes to support PyTorch 2.
infer.inspect by @ordabayevy in #3198CorrLCholeskyTransform in favor of upstream CorrCholeskyTransform by @ordabayevy in #3199pl.Trainer args to argparse by @ordabayevy in #3217Full Changelog: 1.8.4...1.8.5
Allow torch>=2 by @fritzo in #3164
log_prob corr < -1e-8 for SineBivariateVonMises by @OlaRonning in #3165GroupedNormalNormal distribution by @martinjankowiak in #3163Full Changelog: 1.8.3...1.8.4
rename custom_objectives_training.ipynb -> custom_objectives.ipynb by @martinjankowiak in #3141
Full Changelog: 1.8.2...1.8.3
Fix nbshpinx rendering of tutorials by @fritzo in #3055
contrib.funsor.Trace_EnumELBO model enumeration by @ordabayevy in #3063model_args and model_kwargs of render_model by @dilaragokay in #3083batch_expand helper function in air example by @ordabayevy in #3086TraceGraph_ELBO by @ordabayevy in #3081sample in tutorial intro_long by @fraterenz in #3112examples/contrib/funsor/hmm.py by @ordabayevy in #3126Full Changelog: 1.8.1...1.8.2
Update to PyTorch 1.11.0 in #3045
render_model() @karm-patel in #3039minipyro.py to fix #3003 by @luiarthur in #3004Full Changelog: 1.8.0...1.8.1
Introduction to Pyro , a completely new intro tutorial #2991
ProvenanceTensor and numpyr.render_model())AutoMultivariateNormal, but with sparse precision matrix factorization based on dependency structure in the model.A StreamingMCMC class for high-dimensional Bayesian inference using NUTS or HMC, thanks to @mtsokol #2857 . StreamingMCMC is a drop-in replacement for
StreamingMCMC is a drop-in replacement for MCMC that avoids storing samples during inference by streamingly computing statistics such as mean, variance, and r_hat. You can define your own statistics using the pyro.ops.streaming module by either composing existing statistics or defining your own subclass of StreamingStats #2856 .poutine.reparam compatible with initialization logic in autoguides and MCMC #2876 . Previously you needed to manually transform the value in init_to_value() when using a reparametrizer. In Pyro 1.7 you can specify a single init_to_value() output that should work regardless of whether your model is transformed by a reparametrizer. Note this involves a major refactoring of the Reparam interface, namely replacing .call() with .apply(). If you have defined custom reparametrizers using .__call__() you should refactor them before the next Pyro release.AutoNormal this guide is interpretable and structured. Like NeuTraReparam this guide is flexible and can be used to improve geometry for subsequent inference via HMC or NUTS.save_params option, which can save memory #2793pyro.contrib.funsor.infer_discrete #2789poutine.do to avoid duplicate entries in cond_indep_stack #2846infer.csis to ignore unused gradients, thanks to @fshipy #2828mypy for type checking, thanks to @kamathhrishi #2853 #2858black code formatter #2891Update to PyTorch 1.8 release (required).
Normal(loc, scale, validate_args=False).LKJCorrCholesky distribution to upstream LKJCholesky distribution #2771.VonMises) #2736..mode, .edge_mean #2727positive_ordered_vector, corr_matrix #2762sphere #2736.softplus_positive and softplus_lower_cholesky constraints with numerically stable SoftplusTransform and SoftplusLowerCholeskyTransform #2767.VectorizedMarkovMessenger for parallel scan enumeration #2703, #2703 by @ordabayevy.Pins to requirements to torch<1.8 to avoid breaking changes in torch 1.8.0 (introduced in pytorch/pytorch#50547 pytorch/pytorch#50581).
This patch release merely
## New features - #2693 A GumbelSoftmaxReparam for relaxed categorical distributions ## Bug fixes - #2683 Support PyTorch 1.7 - #2682 Fix help(MyDistr
help(MyDistribution)TraceEnum_ELBO.compute_marginals()infer_discrete() finds no discrete sitesDeep Generative Modeling with Single Cell Data
pyroapipotential_fn issues in MCMC. #2591A new pyro.contrib.epidemiology module for discrete-state discrete-time stochastic compartmental models. #2426
AffineAutoregressive, Householder, NeuralAutogregressive, Spline, and GeneralizedChannelPermute flows.Permute and AffineCoupling can operate on a specific dimension with dim keyword argument #2472AffineAutogregressive #2504BatchNorm TransformModule #2459A new Spline transform which implements element-wise rational spline bijections of linear order.
PyroModule compatible with torch.nn.RNN.log_abs_det_jacobian of TransformModulesLocScaleReparam whereby all loc-scale reparameterized sites shared a single centeredness parameter.jit_compile=True flag in HMC/NUTS work for models with pyro.param statements.A new AutoNormal guide that supports data subsampling, thanks to @patrickeganfoley.
Patches 1.2.0 with the following bug fixes:
Patches 1.2.0 with the following bug fixes:
Updated to PyTorch 1.4.0 and torchvision 0.5.0.
This release adds a new effect handler and a collection of strategies that reparameterize models to improve geometry. These tools are largely orthogonal to other inference tools in Pyro, and can be used with SVI, MCMC, and other inference algorithms.
TransformedDistributions..rsample() method. This supports non-Gaussian noise such as Levy Stable and StudentT, but requires reparameterization for inference.MultivariateNormal conversion from scale_tril to precision.pyro.util.save_visualization has been deprecated, and dependency on graphviz is removed.
pyro.infer.ReweightedWakeSleep implements the Reweighted Wake Sleep algorithm (Le et al. 2019). Contributed by Siddharth Narayanaswamy and Tuan Anh Le.
pyro.infer.TraceTMC_ELBO implements the Tensor Monte Carlo marginal likelihood estimator (Aitchinson 2019), a generalization of the importance-weighted autoencoder objective.
pyro.infer.EnergyDistance implements a likelihood-free inference algorithm based on Szekely's energy statistics, a multidimensional generalization of CRPS (Gneiting & Raftery 2007).
pyro.contrib.cevae implements the Causal Inference VAE of (Louizos et al. 2017). See examples/contrib/cevae/synthetic.py for an end-to-end usage example.
pyro.deterministic primitive to record deterministic values in the trace.
pyro.nn.to_pyro_module_() recursively converts an regular nn.Module to a PyroModule in-place.
A default implementation for Distribution.expand() that is available to all Pyro distributions that subclass from TorchDistribution, making it easier to create custom distributions.
.rsample() method but no .log_prob(). This can be fit using EnergyDistance inference.pyro.util.save_visualization has been deprecated, and dependency on graphviz is removed.Behavior of documented APIs will remain stable across minor releases, except for bug fixes and features marked EXPERIMENTAL or DEPRECATED.
The objective of this release is to stabilize Pyro's interface and thereby make it safer to build high level components on top of Pyro.
pyro.contrib may change at any time (though we aim for stability).FutureWarning and specify possible work-arounds. Features marked as deprecated will not be maintained, and are likely to be removed in a future release.nn.Module. PyroModule is already used internally by AutoGuide, EasyGuide pyro.contrib.gp, pyro.contrib.timeseries, and elsewhere.TransformedDistribution(-, AbsTransform()) but providing a .log_prob() method.AutoGuide and EasyGuide are now nn.Modules and can be serialized separately from the param store. This enables serving via torch.jit.trace_module.Auto*Normal family of autoguides now have init_scale arguments, and init_loc_fn has better support. Autoguides no longer support initialization by writing directly to the param store.InverseAutoregressiveFlow to AffineAutoregressive.pyro.generic has been moved to a separate project pyroapi.pyro.contrib.glmm has been moved to pyro.contrib.oed.glmm and will eventually be replaced by BRMP.DeprecationWarnings have been promoted to FutureWarnings.pyro.random_module: The pyro.random_module primitive has been deprecated in favor of PyroModule which can be used to create Bayesian modules from torch.nn.Module instances.SVI.run: The SVI.run method is deprecated and users are encouraged to use the .step method directly to run inference. For drawing samples from the posterior distribution, we recommend using the Predictive utility class, or directly by using the trace and replay effect handlers.TracePredictive: The TracePredictive class is deprecated in favor of Predictive, that can be used to gather samples from the posterior and predictive distributions in SVI and MCMC.mcmc.predictive: This utility function has been absorbed into the more general Predictive class.Patches 0.5.0 with the following bug fixes:
Patches 0.5.0 with the following bug fixes:
pyro.factor to add arbitrary log probability factor to a probabilistic model.
Delta and Independent distributions.n log(n) implementation of the Continuous Ranked Probability Score (CRPS) for sample sets: pyro.ops.stats.crps_empiricalpyro.generic to a separate pyro-api package.logsumexp operation.constraints and transforms module to match torch.distributions.init_to_median.*HMM.filter() methods for forecasting.
New Features:
Fixes:
This release drops support for Python 2. Additionally, it includes a few fixes to enable Pyro to use the latest PyTorch release, version 1.2.
This release drops support for Python 2. Additionally, it includes a few fixes to enable Pyro to use the latest PyTorch release, version 1.2.
Some other additions / minor changes:
pyro.contrib.autoguide to the core Pyro repo.A more flexible easyguide module. Refer to the tutorial for usage instructions.
TracePredictive class.…alternate tensor constructors in JIT to avoid DeprecationWarning.
Updates code for compatibility with PyTorch's latest release of version 1.1.0 - mostly function renaming, and using alternate tensor constructors in JIT to avoid DeprecationWarning.
A capture-recapture example using stochastic variational inference.
TraceTailAdaptive_ELBO.LKJCorrCholesky, SpanningTree.RadialFlow, DeepSigmoidalFlow, BatchNormTransform.pyro.contrib.minipyro now supports constrained parameters.pyro.generic module to support an API for backend-agnostic Pyro models. This makes it easier to switch between full Pyro and Minipyro. New backends like funsor and numpyro are under active development.pyro.contrib.conjugate that provides utilities for exact inference on a small subset of conjugate models.Categorical.log_prob so that evaluation on the distribution's support is much faster leading to almost 2X faster inference on models with enumerated discrete random variables.pyro.module ignores params with requires_grad=False.MaskedDistribution when run under torch.jit.trace.Nothing published for this version
Renamed ubersum(..., batch_dims=...) (deprecated) to einsum(..., plates=...).
ubersum(..., batch_dims=...) (deprecated) to einsum(..., plates=...).target_accept_prob and max_tree_depth as arguments to the constructor to allow finer grained control over hyper-parameters.Note also that Pyro 0.3 now uses PyTorch 1.0, which makes a number of breaking changes.
Building on poutine.broadcast, Pyro's SVI and HMC inference algorithms now support parallel sampling. For example to use parallel sampling in SVI, create an ELBO instance and configure two particles options, e.g.
elbo = Trace_ELBO(num_particles=100,
vectorize_particles=True)
TraceEnum_ELBO, HMC, NUTS, and infer_discrete can now exactly marginalize-out discrete latent variables. For dependency structures with narrow treewidth, Pyro performs cheap marginalization via message-passing algorithms, enabling classic learning algorithms such as Baum-Welch for HMMs, DBNs, and CRFs. See our enumeration tutorial for details.
MaskedMixture interleaves two distributions element-wise, as a succinct alternative to multiple sample statements inside multiple poutine.mask contexts.RelaxedBernoulliStraightThrough and RelaxedOneHotCategoricalStraightThrough
These are discrete distributions that have been relaxed to continuous space and thus are equipped with pathwise gradients. Thus these distributions can be useful in the context of variational inference, where they can provide lower variance (but biased) gradient estimates. Note that these distributions may be numerically finicky so please let us know if you run into any problems.VonMises and VonMises3D are likelihood-only distributions that are useful for observing 2D or 3D angle data.AVFMultivariateNormal is a multivariate normal distribution that comes equipped with an adaptive gradient estimator that can lead to reduce gradient variance.MixtureOfDiagNormals, MixtureOfDiagNormalsSharedCovariance and GaussianScaleMixture are three families of mixture distributions that come equipped with pathwise gradient estimators (which tend to yield low variance gradients).PlanarFlow and PermutationFlow are two transforms useful for constructing normalizing flows.InverseAutoregressiveFlow improvements such as an explicit inversion operator.This isn't really a feature of Pyro, but we'd like to point out a new feature of the excellent GPyTorch library: GPyTorch can now use Pyro for variational inference, and GPyTorch models can now be used in Pyro models. We recommend the new TraceMeanField_ELBO loss for GPyTorch models.
TraceMeanField_ELBO can take advantage of analytic KL divergence expressions in ELBO computations, when available. This ELBO implementation makes some restriction on variable dependency structure. This is especially useful for GPyTorch models.
An implementation of the Importance Weighted ELBO objective (pyro.infer.RenyiELBO) is now included. This implementation also includes the generalization of IWELBO to the alpha-divergence (or Rényi divergence of order α) case.
max_plate_nestingPyro's ELBO implementations can now automatically determine max_plate_nesting (formerly know as max_iarange_nesting) in models with static plate nesting structure.
Some new autoguides are implemented: AutoIAFNormal and AutoLaplaceApproximation.
The PyTorch JIT compiler currently has only partial support for ops used in Pyro programs. If your model has static structure and you're lucky enough to use ops supported by the JIT, you can sometimes get an order-of-magnitude speedup. To enable the JIT in SVI, simply replace Trace_ELBO, TraceGraph_ELBO, or TraceEnum_ELBO classes with their JIT wrappers JitTrace_ELBO, JitTraceGraph_ELBO, or JitTraceEnum_ELBO. To enable the JIT in HMC or NUTS pass the jit_compile kwarg. See our JIT tutorial for details.
pyro.ops.stats contains many popular statistics functions such as resample, quantile, pi (percentile interval), hpdi (highest posterior density interval), autocorrelation, autocovariance, etc
Pyro now provides more validation checks and better error messages, including shape logging using the Trace.format_shapes() method. This is very useful for debugging shape errors. See the tensor shapes tutorial for help in reading the shapes table.
and additional examples in the examples directory.
pyro.plate replaces all of pyro.irange, pyro.iarange, and poutine.broadcast. You should no longer need to use poutine.broadcast manually.independent() is now renamed to_event()poutine.mask was separated from poutine.scale. Now you should use poutine.mask with ByteTensors and poutine.scale for positive tensors (usually just scalars)..enumerate_support(expand=False)LowRankMultivariateNormal and HalfNormal.get_param(name) and .fix_param(name, value) are removed..autoguide(name, ...). And we have implemented Bayesian GPLVM model to illustrate autoguide functionality..sum(), .product() are removed. Instead, we encourage users using a better paradigm: Sum(kern0, kern1), Product(kern0, kern1).Note also that Pyro 0.3 now uses PyTorch 1.0, which makes a number of breaking changes.
We are releasing the following features early, intended for experimental use only. Pyro provides no backward-compatibility guarantees for these features.
pyro.contrib.tracking is provides some experimental components for data association and multiple-object tracking. See the object tracking and Kalman Filter tutorials for examples of using the library.
pyro.contrib.oed This package provides some support for doing Bayesian Optimal Experimental Design (OED) in Pyro. In particular it provides support for estimating the Estimated Information Gain, which is one of the key quantities required for Bayesian OED. This package is in active development and is expected to undergo significant changes. See the docs for more details.
pyro.contrib.autoname provides some automatic naming utilities that can ease the burden of subscripting like "x_{}".format(t).
`@poutine.broadcast` is a new effect hadler that allows sample site shapes to be automatically broadcast based on their enclosig iaranges. This makes
@poutine.broadcast is a new effect hadler that allows sample site shapes to be automatically broadcast based on their enclosig iaranges. This makes it very easy to experiment with different models by moving sample sites in and out of iaranges without any manual .expand() changes. See the tensor shapes tutorial for details.pyro.optim.PyroLRScheduler makes it easy to use PyTorch learning rate schedulers in Pyro.pyro.contrib.autoguide now supports custom name prefixes and has more thorough error messages for name collision. This makes it easier to combine multiple autoguide strategies.pyro.ops.newton.newton_step_2d is a fast differentiable optimizer for batched 2-dimensional loss functions that are themselves twice differentiable.pyro.contrib.gp.kernels.Coregionalize and pyro.contrib.autoguide.AutoLowRankMultivariateNormal both provide models multivariate data with low-rank plus diagonal covariance.TorchDistribution.expand() is more flexible and more PyTorch idiomatic than the older TorchDistribution.expand_by().Pyro 0.2 supports PyTorch 0.4. See PyTorch release notes for comprehensive changes. The most important change is that Variable and Tensor have been me
Pyro 0.2 supports PyTorch 0.4. See PyTorch release notes for comprehensive changes. The most important change is that Variable and Tensor have been merged, so you can now simplify
- pyro.param("my_param", Variable(torch.ones(1), requires_grad=True))
+ pyro.param("my_param", torch.ones(1))
PyTorch's torch.distributions library is now Pyro’s main source for distribution implementations. The Pyro team helped create this library by collaborating with Adam Paszke, Alican Bozkurt, Vishwak Srinivasan, Rachit Singh, Brooks Paige, Jan-Willem Van De Meent, and many other contributors and reviewers. See the Pyro wrapper docs for wrapped PyTorch distributions and the Pyro distribution docs for Pyro-specific distributions.
Parameters can now be constrained easily using notation like
from torch.distributions import constraints
pyro.param(“sigma”, torch.ones(10), constraint=constraints.positive)
See the torch.distributions.constraints library and all of our Pyro tutorials for example usage.
Arbitrary tensor shapes and batching are now supported in Pyro. This includes support for nested batching via iarange and support for batched multivariate distributions. The iarange context and irange generator are now much more flexible and can be combined freely. With power comes complexity, so check out our tensor shapes tutorial (hint: you’ll need to use .expand_by() and .independent()).
Discrete enumeration can now be parallelized. This makes it especially easy and cheap to enumerate out discrete latent variables. Check out the Gaussian Mixture Model tutorial for example usage. To use parallel enumeration, you'll need to first configure sites, then use the TraceEnum_ELBO losss:
def model(...):
...
@config_enumerate(default="parallel") # configures sites
def guide(...):
with pyro.iarange("foo", 10):
x = pyro.sample("x", dist.Bernoulli(0.5).expand_by([10]))
...
svi = SVI(model, guide, Adam({}),
loss=TraceEnum_ELBO(max_iarange_nesting=1)) # specify loss
svi.step()
This release adds experimental support for gradient-based Markov Chain Monte Carlo inference via Hamiltonian Monte Carlo pyro.infer.HMC and the No U-Turn Sampler pyro.infer.NUTS. See the docs and example for details.
A new Gaussian Process module pyro.contrib.gp provides a framework for learning with Gaussian Processes. To get started, take a look at our Gaussian Process Tutorial. Thanks to Du Phan for this extensive contribution!
Guides can now be created automatically with the pyro.contrib.autoguide library. These work only for models with simple structure (no irange or iarange), and are easy to use:
from pyro.contrib.autoguide import AutoDiagNormal
def model(...):
...
guide = AutoDiagonalNormal(model)
svi = SVI(model, guide, ...)
Model validation is now available via three toggles:
pyro.enable_validation()
pyro.infer.enable_validation()
# Turns on validation for PyTorch distributions.
pyro.distributions.enable_validation()
These can also be used temporarily as context managers
# Run with validation in first step.
with pyro.validation_enabled(True):
svi.step()
# Avoid validation on subsequent steps (may miss NAN errors).
with pyro.validation_enabled(False):
for i in range(1000):
svi.step()
We've added support for vectorized rejection sampling in a new Rejector distribution. See docs or RejectionStandardGamma class for example usage.
Misc improvements in documentation
Workarounds to avoid segfault on PyTorch 0.2
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →