Something changed in `pytensor > 2.12.3` (and thus `pymc > 5.6.1`) that makes my `pytensor.gradient.grad` call get stuck - any ideas?

One step forward, two steps back… At least I’m sort of learning something … I hope you guys could help again please, I’m starting to lose my mind :smiley:

My latest process is here in this gist 994x_mre_copula_with_jcd · GitHub

I have implemented a function get_log_jcd (see the gist) based on @jessegrabowski 's suggestion albeit that only works in pytensor >= 2.16.0 with the new Blockwise(SLogDet). So I’ve allowed it to take an advanced tuple index too so that I can also use it in the olde worlde.

Regardless, get_log_jcd seems to work when I call it by an eval(), hurray! One step forward.

The step back is that I still get a ValueError related to RNGs:

with mdl:
    initial_points, step = pm.init_nuts(init='auto', chains=1)
ValueError: No update found for at least one RNG used in Scan Op Scan{scan_fn, while_loop=False, inplace=none}.
You can use `pytensorf.collect_default_updates` inside the Scan function to return updates automatically.

I looked into @ricardoV94 's suggestion regarding mdl.rvs_to_values but this doesn’t contain my Deterministic y_c and Mutable Data y, so I dont know how to proceed…

mdl.rvs_to_values
{m_mu ~ Normal(0, 1): m_mu,
 m_s ~ InverseGamma(5, 4): m_s_log__,
 lkjcc ~ _lkjcholeskycov(2, 2, InverseGamma(5, 4)): lkjcc_cholesky-cov-packed__}