-
-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine irange + iarange + broadcast into pyro.plate #1465
Comments
@jwvdm I hope this interface is more intuitive! |
@ndgAtUber Are you ok with this renaming? We will maintain full backwards-compatibility. |
could you point me to some examples of models written with this new interface? (i like the cleanup and merging idea, but i want to think through the interface, to make sure it will be as clear as possible.) |
@ngoodman Take a look at test_valid_models.py. |
@fritzo: I really like the name When @esennesh and I went through your Tensor Shape Tutorial, the thing that was arguably the hardest to grok is the with pyro.iarange("d_iarange", 3):
d = pyro.sample("d", Normal(torch.zeros(3, 4, 5), 1).independent(2)) Part of this is due to the naming -- if I understand correctly The other thing that is just hard to wrap your head around is how plate aligns with dimensions in the batch shape. I actually think that you guys got this right, it just takes some getting used to. Just to check my own comprehension here: What happens when you do with pyro.iarange("d_iarange", 2, dim=-2):
d = pyro.sample("d", Normal(torch.zeros(3, 4, 5), 1).independent(2)) This should yield A final note: the using (Variable.ForEach(n)) {
z[n] = Variable.Discrete(weights);
using (Variable.Switch(z[n])) {
data[n] = Variable.VectorGaussianFromMeanAndPrecision(
means[z[n]], precs[z[n]]);
}
} |
you're not the first person to make this comment. i agree the original semantics would be more intuitive if |
i really like the move toward simplifying the interface! i don't love the current idiom (though it's better than iarrange, etc). the nice thing about mapData and ForEach is that they feel very intuitive because they are explicit about what variable they bind. for example in the simplest case:
it feels like the i guess there is a bit of mismatch between the current sleekness where pyro.plate is about indexing and independence not specific values and my intuitions about iterating.... but maybe there is a happy middle ground? or a layer of helper functions that makes the standard iterating-over-data case clear? |
This behavior is still preserved, and you can still iterate over a |
New users of Pyro have often found it difficult to inderstand the interplay between
iarange
,irange
, and@broadcast
. This issue proposes to merge these three concepts into a singleplate
.Historically @fritzo split
map_data
intoirange
+iarange
, @neerajprad added@broadcast
. Now that our usage patterns have converged, @eb8680 suggested makingiarange
andirange
into messengers, in which case all can be fused.Tasks
Make plate into a handler? (requires replacing:class:
with:func:
in docstrings)The text was updated successfully, but these errors were encountered: