pyro icon indicating copy to clipboard operation
pyro copied to clipboard

List: move these things upstream to PyTorch, Funsor, etc.

Open fritzo opened this issue 5 years ago • 2 comments

This issue tracks Pyro components that should be moved to upstream dependencies.

Move to PyTorch

  • [x] constraints.IndependentConstraint
    • usage in MultivariateNormal
    • usage in dist.Independent
  • [ ] dist.Delta #1781
  • [ ] constraints.integer
  • [ ] Geometric.log_prob() as patched in pyro/distributions/torch.py
  • [ ] Uniform's ._unbroadcasted_* logic
  • [ ] _with_cache() in pyro/infer/reparam/unit_jacobian.py
  • [ ] dist.DirichletMultinomial https://github.com/pytorch/pytorch/issues/56030

Move to Funsor

See also https://github.com/pyro-ppl/funsor/issues/362

  • [ ] distributions.util.detach()
  • [ ] ops.tensor_utils.haar_transform() and .inverse_haar_transform()

fritzo avatar Sep 16 '20 16:09 fritzo

@fritzo out of curiosity is there a tutorial on the process for migrating code, updating docs and writing tests?

RylanSchaeffer avatar Apr 17 '21 15:04 RylanSchaeffer

@RylanSchaeffer there is no tutorial on migrating distributions. To migrate a distribution from Pyro to PyTorch you'd need to

  • add code to torch/distributions/dirichlet_multinomial.py or torch/distributions/conjugate.py
  • fix docstrings to follow numpy syntax rather than sphinx syntax
  • import distributions in torch/distributions/init.py
  • add test examples at the end of the global EXAMPLES list in test/distributions/test_distributions.py
  • add an entry in docs/source/distributions.rst
  • cc @neerajprad and I on the pull request.

See for example https://github.com/pytorch/pytorch/pull/48798/files

fritzo avatar Apr 18 '21 15:04 fritzo