Applying an MCMC Step to Sample from Distribution with KL Divergence Term

@ricardoV94 thanks for the suggestion! Can you elaborate on or point to some docs on what the RandomVariable API includes? As I understand it, the var argument to pm.Potential is itself supposed to be a RandomVariable.

The main issue we seem to be having now with CustomDist boils down to how pytensor is trying to infer the shape of the support using the parameters. Specifically, it’s failing on this line because our parameters are 2 scalars but our RV is a potentially high-d vector, but this function seems to assume that shape of the zero’th parameter is the shape of the RV (why would that be true??). So, I think we may have a case noted in the comments that requires some “custom logic” but I’m not sure where that logic would go. I am surprised that explicitly passing shape= or size= to CustomDist doesn’t do the trick. Is that a bug?