-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Not entirely obvious where this function lives.
import pymc as pm
import pymc.dims as pmd
from pytensor.xtensor import as_xtensor
coords = {"repo": ["pymc", "pymc-marketing"]}
with pm.Model(coords=coords) as model:
lam = pmd.HalfNormal("lam", dims="repo")
pmd.Exponential(
"obs",
lam=lam,
observed=[5, 7],
dims="repo",
)ValueError: Variable [5, 7] must have dims associated with it.
To avoid subtle bugs, PyMC does not make any assumptions about the dims of parameters.
Use `as_xtensor` with the `dims` keyword argument to specify the dims explicitly.
My suggestion would be to be more explicit here with pytensor.xtensor.as_xtensor:
pymc/pymc/dims/distributions/core.py
Lines 134 to 138 in ebd836e
| raise ValueError( | |
| f"Variable {x} must have dims associated with it.\n" | |
| "To avoid subtle bugs, PyMC does not make any assumptions about the dims of parameters.\n" | |
| "Use `as_xtensor` with the `dims` keyword argument to specify the dims explicitly." | |
| ) |
Metadata
Metadata
Assignees
Labels
No labels