Tensor sizes do not match while sampling



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 https://colab.research.google.com/drive/1aGGy29X3h8iRZOiFK8UeqMyuEfdOTp_8

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?



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: