Automatic transformation of constrained distributions in Turing.jl

This is a question about automatic transformation of constrained distributions.

The docs on compiler design say “Random variables whose distributions have a constrained support are transformed using a bijector from Bijectors.jl so that the sampling happens in the unconstrained space.”

Suppose the following model:

@model function gdemo(x, y)
    s² ~ InverseGamma(2, 3)
    mu ~ Uniform(0, 1)
    x ~ Normal(mu, sqrt(s²))
    return y ~ Normal(mu, sqrt(s²))


  • If I use an HMC sampler (e.g. NUTS), do I need to manually transform the distribution of mu or can I rely on Turing.jl to do this for me?
  • If I can, how can I find out the details of the transformation?
  • When I look at my samples in the returned chain, will they be in the unconstrained space or will they be in the original constrained space?

Thank you!