Reduce need to transpose

Hi!

Thanks for a great package, I have been using Pyro for a few different projects now and it is really amazing! Definitely better than the other probabilistic programming packages I have tried and far better than implementing from scratch :slight_smile:

If I may make a small suggestion/feature request, I was wondering if there are plans to reduce the need for transposes, .reshape(-1,1) and code like

try:
    var1 = pyro.sample("var1", dist.Categorical(params.T))
except ValueError:
    var1 = pyro.sample("var1", dist.Categorical(params))

in a future version? I understand why they are necessary and it is only a minor annoyance but I find these make the code somewhat harder to read and debug, and it is not always clear without running the code where they are needed.

Thanks again!!!

Hi @pyro.technician, Glad to hear you’re enjoying Pyro :grinning_face_with_smiling_eyes: I agree tensor shape manipulation is the most cumbersome aspect of the Pyro front end. In the short term I think the best we can do is make minor fixes to approach a local optimum in readability. In the long term @eb8680_2 and I believe in replacing the entire Tensor abstraction of positional dimensions with more name-based abstractions from programming language theory. Our efforts in this direction are embodied in the Funsor library, and @eb8680_2 has been working towards a Pyro 2.0 based on these abstractions, starting with pyro.contrib.funsor.

1 Like