ARTICLE AD BOX
This is the error i got today while importing pymc, which i had just updated. It worked fine before the update, but anyways, the error arises because pymc\variational\opvi.py tries to import "unbroadcast" from pytensor\tensor\shape, but the "unbroadcast" function doesn't exist! I fixed it as follows: first i commented the import line, then i modified the following line (line 1105 in opvi.py):
initial = unbroadcast(initial, *unbroadcast_axes)to:
for ax in unbroadcast_axes: initial = pt.Rebroadcast((ax, False))(initial)With this, pymc seems to be working fine. Still, i posted this both in case others encounter the same problem, and to ask whether that fix is really correct, because it's an AI-generated fix, which i don't trust. Also, i have absolutely no experience with pytensor, and i'm just starting to learn pymc.
I have pymc version 5.23.0, pytensor version 2.31.7, this happened today when i installed pymc-extras, and i use mamba as a package manager, and i program in VScode.
Edit: for another oddity, if i try to import pymc_extras, this happens:
AttributeError: module 'pymc' has no attribute 'distributions'
Because pymc_extras\distributions\discrete.py has the following at line 109:
class GeneralizedPoisson(pm.distributions.Discrete):As it happens, in the pymc files there is a folder called distributions, which contains a file called distribution.py, in which a Discrete class is defined (line 633), but still, changing the above to pm.distribution
