-
Notifications
You must be signed in to change notification settings - Fork 219
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
Automatic lazy broadcasting/optimization for arrays of distributions #1723
Comments
Just a heads up, my plan is to remove |
Cool, good to know. So would that that resolve the tracked-array vs. array-of-tracked issue @mohamed82008 was referring to in the discourse thread? |
Hi, following this issue because I'm very interested in what ultimately is going to be the fast way to handle something like this. Currently the most reliable (doesn't cause crashes/backtraces) is for me to do |
We will likely adopt #1723 (comment). In addition, it is better to keep the |
This issue follows up on this Discourse discussion. As @mohamed82008 explained, there multiple performance advantages to using a
LazyArray
inside anarraydist
. To realize them, however, one must a) know about this lazy-array trick, and b) remember/look up theLazyArray
syntax (which unfortunately includes a macro@~
, which is similar but unrelated to Turing/DynamicPPL's~
).Would it be possible to make the lazy-array trick more automatic? From a user perspective, I can think of a couple of ways this would work:
arraydist
convert its argument to a lazy array automatically (maybe based on some heuristic of when it's likely to benefit performance, and/or an optional argumentlazy=true
)@lazyarraydist(...broadcasted computation...)
to do the same thing.~
parse to a lazily broadcasted array distributionIf 3) could work, that would be best, though I don't know if it would come with hidden downsides or implementation challenges. Basically, anything that decreases the number of special-case optimization hacks a user has to remember would be great!
The text was updated successfully, but these errors were encountered: