-
Notifications
You must be signed in to change notification settings - Fork 221
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
Vectorization of assume #255
Comments
I did a simple check: # Test for vectorize UnivariateDistribution
@model vdemo(x) = begin
s ~ InverseGamma(2,3)
m ~ Normal(0,sqrt(s))
x ~ Normal(m, sqrt(s))
# for i = 1:length(x)
# x[i] ~ Normal(m, sqrt(s))
# end
return s, m
end with With the loop way, it will take 1m26s but with vectorize version (bb25da0) only 2.25 seconds. If we can also do that for at lease iid distributions priors, we can certainly speed up the |
Cont'd run by |
That's exciting! We can slowly add more vectorisation support. |
One possible and simple way to vectorize i.i.d priors is to create some customized distributions like |
|
I've done the vectorization for assume with univarite distributions. Here are some experiment results
Time for each
I believe the gap between vec and Mv means there is still space to improve Turing in terms of vectorization. |
|
NOTE
|
Closed by #281 |
The most easy one is to vectorize
observe
where the distributions are all the same.observe
for distributions which are different andassume
are challenging. I will do the easiest one first.-- update on 30 May --
TODOs
support Matrix-variate (interface)assume()
Left todos are moved to PR #281
The text was updated successfully, but these errors were encountered: