Tensor sizes do not match while sampling

Hello,

I am getting this error

The size of tensor a (200) must match the size of tensor b (2) at non-singleton dimension 0

the notebook with details is here Google Colab

What’s strange that there are two passes and on the first pass the shape size of var z2 is as expected, but then it changes from 200 to 2.

Could somebody clarify why does this happen? Is there some trivial thing that I’ve missed with Pyro?

Thanks

Hi @tasubo, could you try to add .to_event() to your distributions or use pyro.plate(...) statement in your model? In Pyro, it is required that “All dimensions must be declared either dependent or conditionally independent.” You can take a look at tensor shape tutorial to get a sense of it. :slight_smile: