Example Thanasi Bakis in Slack:
using Turing
function loglik(θ, x)
println("In loglik")
return logpdf(Normal(θ, 1), x)
end
@model function test(x)
θ ~ Normal(0, 1)
if DynamicPPL.leafcontext(__context__) !== Turing.PriorContext()
println(DynamicPPL.leafcontext(__context__))
Turing.@addlogprob! sum(loglik.(θ, x))
end
end
sample(test(randn(100) * 1000), Prior(), 100)
results in DefaultContext rather than PriorContext.