pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Port SymbolicRandomVariable Op to PyTensor and get rid of many RVs in PyTensor

Open ricardoV94 opened this issue 10 months ago • 0 comments

Description

In PyMC we have a SymbolicRandomVariable that allows defining an OpFromGraph that looks almost like a RandomVariable but is just built symbolically. This avoids having to define too many Ops (and backend dispatches). We should try to port it to PyTensor and make sure that everything than in PyTensor works with pure RandomVariable also works with the Symbolic counterparts.

From the top of the mind we have to make RandomStreams and RV rewrites compatible.

This is the class (it contains things that don't make sense in PyTensor, like the MeasurableOp): https://github.com/pymc-devs/pymc/blob/ce5f2a27170a9f422f974fdf9fc415dfe53c35cb/pymc/distributions/distribution.py#L211-L399

Here is an example of how a Symbolic RV is then defined: https://github.com/pymc-devs/pymc/blob/ce5f2a27170a9f422f974fdf9fc415dfe53c35cb/pymc/distributions/continuous.py#L1217-L1238

ricardoV94 avatar Feb 19 '25 09:02 ricardoV94