Skip to content

Develop#2212

Closed
esennesh wants to merge 9 commits into
pyro-ppl:masterfrom
esennesh:develop
Closed

Develop#2212
esennesh wants to merge 9 commits into
pyro-ppl:masterfrom
esennesh:develop

Conversation

@esennesh

@esennesh esennesh commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Just some very minor things I've run into working on improving numpyro.

esennesh and others added 9 commits December 12, 2025 18:42
Signed-off-by: Eli Sennesh <elisennesh@gmail.com>
…check

Signed-off-by: Eli Sennesh <elisennesh@gmail.com>
…alue()

Signed-off-by: Eli Sennesh <elisennesh@gmail.com>
xla_pmap_p was removed from jax.extend.core.primitives in JAX 0.10.2.
Guard the import and registration with try/except and a None check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dependent

TransformedDistribution.sample_with_intermediates caches the pre-transform
base sample so that log_prob(value, intermediates) can reuse it instead of
recomputing transform.inv(value). That optimization was silently lost when the
transformed distribution was wrapped:

- Independent inherited the base no-op sample_with_intermediates (returning an
  empty []), so the cached value never reached the trace, and its log_prob did
  not accept intermediates.
- ExpandedDistribution.log_prob ignored the intermediates it was passed (it
  carried a "TODO: utilize intermediates").

Independent only reinterprets batch dims as event dims and does not reshape the
sample, so it can forward the base distribution's intermediates unchanged;
ExpandedDistribution already produces intermediates in sample_with_intermediates
and now forwards them in log_prob. Both remain backward compatible
(intermediates defaults to None).

For a TransformedDistribution wrapped by to_event()/expand() (e.g. a smoothed
discrete site), this lets log_prob reuse the sampled base value rather than
inverting the transform, an 11x speedup on an adaptive-inverse transform whose
inverse is an iterative solve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@esennesh esennesh closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant