You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that Enzyme is not yet fully supported by Turing, so apologies if this issue is mistimed.
While Enzyme boosts efficiency with a simple linear model, I noticed that adding a simple variable transformation (that computes the polynomials) within the model critically slows down turning (but not the default AD).
using Distributions
using Enzyme
using Turing
using ADTypes
Enzyme.API.runtimeActivity!(true)
functiondata_poly(x, degree=2)
returnhcat([x .^ d for d in1:degree]...)
end@modelfunctionmodel(y, x)
X =data_poly(x, 2)
# Priors
μ_intercept ~Normal(0, 3)
μ_x1 ~Normal(0, 3)
μ_x2 ~Normal(0, 3)
σ ~Normal(0, 3)
# Likelihoodfor i ineachindex(y)
μ = μ_intercept + μ_x1 * X[i, 1] + μ_x2 * X[i, 2]
y[i] ~Normal(μ, exp(σ))
endend
y =rand(Normal(0, 1), 1000)
x = y .+rand(Normal(0, 1.5), 1000)
sample(model(y, x), NUTS(), 1000) # 5.7 secondssample(model(y, x), NUTS(; adtype =AutoEnzyme()), 1000) # ~6min
Any pointers to what I'm doing wrong?
The text was updated successfully, but these errors were encountered:
I know that Enzyme is not yet fully supported by Turing, so apologies if this issue is mistimed.
While Enzyme boosts efficiency with a simple linear model, I noticed that adding a simple variable transformation (that computes the polynomials) within the model critically slows down turning (but not the default AD).
Any pointers to what I'm doing wrong?
The text was updated successfully, but these errors were encountered: