I have a model written in Stan that I am trying to test with pyro. Unfortunately it tends to run into some problems with HMC - namely some initial proposal values tend to explode and producing invalid values (overflow).

The model is for an eQTL effect size, described here in detail, but the main problem part is this:

```
beta ~ normal(0, 1); // actually, it's a normal mixture prior, but for simplicity
if (indicator[i] == 0) {
mu[i] = 0;
} else if (indicator[i] == 1) {
mu[i] = log1p(exp(beta)) - log(2);
} else if (indicator[i] == 2) {
mu[i] = beta;
}
```

Now in Stan I can constrain `beta`

to be in the range [-10, 10], which easily covers the plausible range of effect sizes and prevents any overflow/underflow. However, `sample`

statements in Pyro don’t allow these , so `beta`

will get one proposal that’s a large value (eg, 139533), and then fail with `OverflowError`

.

Is there a way to enforce a constraint here?