Skip to content

Conversation

@ricardoV94
Copy link
Member

Only _logprob had a dispatch before

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.90%. Comparing base (c868a84) to head (d1015d9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8083   +/-   ##
=======================================
  Coverage   90.89%   90.90%           
=======================================
  Files         123      123           
  Lines       19489    19506   +17     
=======================================
+ Hits        17714    17731   +17     
  Misses       1775     1775           
Files with missing lines Coverage Δ
pymc/dims/distributions/core.py 90.90% <100.00%> (+0.90%) ⬆️
pymc/logprob/basic.py 100.00% <100.00%> (ø)
pymc/testing.py 90.64% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 force-pushed the support_more_logp_methods_dims branch from f1b70ef to d1015d9 Compare January 31, 2026 21:53
@_logprob.register(MeasurableXTensorFromTensor)
def measurable_xtensor_from_tensor(op, values, rv, **kwargs):
rv_logp = _logprob(rv.owner.op, tuple(v.values for v in values), *rv.owner.inputs, **kwargs)
def _to_xtensor(expr, op: MeasurableXTensorFromTensor):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: expr is a vague variable name. I associated it with polars expressions, definitely would not have guessed that we want to pass one of _logprob, _logcdf or _icdf here

x = Normal.dist(
mu=as_xtensor(mean, dims=("city",)),
sigma=1,
dim_lengths={"time": 5},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no time dim declared, is this a non-public API for making a dims-aware RV?

Copy link
Member Author

@ricardoV94 ricardoV94 Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how you specify shape in pymc.dims/xtensor.random variables. There's no size/shape argument, only this. When you are in a model context with a named variable, it forwards this information from model.dim_lengths, but if you are working with a .dist you work with this manually.

@jessegrabowski
Copy link
Member

Approved but there's a failing test, i guess unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants