What are @ad and @addr macros in Julia?

77 views Asked by At

I am going through an example for Gen module in Julia from here and I stumbled across this code:

@compiled @gen function generate_datum(x::Float64, prob_outlier::Float64, noise::Float64, 
                             @ad(slope::Float64), @ad(intercept::Float64))

    if @addr(bernoulli(prob_outlier), :is_outlier)
        (mu, std) = (0., 10.)
    else
        (mu, std) = (x * slope + intercept, noise)
    end
    return @addr(normal(mu, std), :y)
end

which throws

UndefVarError: @addr not defined

And the same for @ad which I suspect is the same thing. As a I am new to Julia and search does not return anything vaguely relevant I am stuck. Could anybody help?

1

There are 1 answers

0
logankilpatrick On BEST ANSWER

Per https://github.com/probcomp/Gen/issues/161, the file your link points to is no longer part of the repo. Those macros were deleted and the master branch reflects that! If you wanted to run those examples, you would need to switch to an older version of Gen.