I rewrote my example so that’s reproducible:

```
n_obs = 10000
true_lag = 2
lead = np.random.normal(loc=0, scale=0.5, size=n_obs + true_lag)
y_obs = -2.0 * lead[:-true_lag] + np.random.normal(loc=0, scale=0.4, size=n_obs)
lead = lead[true_lag:]
with pm.Model() as model:
lead = pm.ConstantData("lead", value=lead)
alpha = pm.Normal("alpha")
lag = pm.DiscreteUniform("lag", 1, 3)
p = pm.Deterministic("p", pm.math.switch(lag <= 1, lead[11:-1],
pm.math.switch(lag <= 2, lead[10:-2], lead[9:-3])))
sigma = pm.HalfNormal("sigma")
y = pm.Normal("y", alpha * p, sigma=sigma, observed=y_obs[12:])
trace = pm.sample(5000, tune=1000)
```

When I replace the eyesore of the pm.math.switch onion with this:

```
p = pm.Deterministic("p", lead[12-lag:-lag])
```

I see the following error:

```
ParallelSamplingError: Chain 3 failed with: Input dimension mismatch. One other input has shape[0] = 0, but input[2].shape[0] = 9988.
Apply node that caused the error: Elemwise{Composite}(InplaceDimShuffle{x}.0, Subtensor{int64:int64:}.0, y{[-1.432294...12875804]}, InplaceDimShuffle{x}.0, TensorConstant{(1,) of -0.5}, TensorConstant{(1,) of 0...5332046727}, Elemwise{log,no_inplace}.0, Elemwise{gt,no_inplace}.0, TensorConstant{(1,) of -inf})
Toposort index: 23
Inputs types: [TensorType(float64, (1,)), TensorType(float64, (?,)), TensorType(float64, (9988,)), TensorType(float64, (1,)), TensorType(float64, (1,)), TensorType(float64, (1,)), TensorType(float64, (1,)), TensorType(bool, (1,)), TensorType(float32, (1,))]
Inputs shapes: [(1,), (0,), (9988,), (1,), (1,), (1,), (1,), (1,), (1,)]
Inputs strides: [(8,), (8,), (8,), (8,), (8,), (8,), (8,), (1,), (4,)]
Inputs values: [array([0.]), array([], dtype=float64), 'not shown', array([1.]), array([-0.5]), array([0.91893853]), array([0.]), array([ True]), array([-inf], dtype=float32)]
Outputs clients: [[Sum{acc_dtype=float64}(sigma > 0)]]
```