The code generated by the logprob
macro is not AD friendly. Try the function:
Turing.gradient_logp(Turing.ZygoteAD(), θ, Turing.VarInfo(model), model)
but you need to define the model using MyModel(x)
and θ
should be the vector of random variables in order of appearance in the model. In this case, it is just [σ]
.