pyro-ppl / pyro

Deep universal probabilistic programming with Python and PyTorch
http://pyro.ai
Apache License 2.0
8.44k stars 986 forks source link

Incorrect stack terminology in Poutine and minipyro.py #3088

Open lwiklendt opened 2 years ago

lwiklendt commented 2 years ago

The Poutine example page and the minipyro.py example script flip the standard terminology of the stack data structure. One adds and removes from the top of the stack, but in these pages this is flipped. As pedagogical resources, this inverted terminology adds unnecessary confusion.

For example, when iterating over the stack in minipyro.py:

PYRO_STACK is reversed so that effect handlers higher in the stack are first applied.

and in http://pyro.ai/examples/effect_handlers.html#Interlude:-the-global-Messenger-stack:

Messenger.__enter__ appends a Messenger to the end (the bottom) of the global handler stack

eb8680 commented 2 years ago

@lwiklendt moved to the Pyro repository, since the content in question is stored here. Feel free to open a PR with changes to those examples that you think would clarify the terminology.

fritzo commented 2 years ago

@lwiklendt Thanks, I may be blamed here, as I at one point insisted that "stacks can only be mutated at the top: pushed onto the top or popped off of the top", but we only ever got part way through updating docs. (Pancake intuition 🥞 🤷 )

We'd happily accept PRs clarifying or making docs more consistent