Hello,

In my model, the parameter I am trying to evaluate influences the size (length) of the array of the `observed`

variable. Think of it as a parameter that makes a time-dependent function reach a goal faster or slower depending on that parameter, hence the results length vary a little.

As I was mentioning in my other question in my test with fake data, I have a parameter whose real values is 6000, and so I start with a Normal distribution at 5500, with an `sd=1000`

. Thanks to @twiecki I have put `pm.Metropolis(scaling=100)`

and this helps in searching the domain, to hopefully reach the 6000 value.

Nevertheless, when the Metropolis sampler starts, my `observed`

variable `Y`

has a size of 1186 (corresponding to the parameterās value of 6000). Now when I try different values of this parameter, the size of the observation changes slightly, going to 1159 for instance, and then at the next trying point, 1164 for instance. At the second step I get the a Theano error about dimensions mismatch: `ValueError: Input dimension mis-match. (input[3].shape[0] = 1159, input[4].shape[0] = 1164)`

Here is how my code is setup, I tried to do the following trick at the end in my `@as_op`

function `proc_test(alpha)`

:

```
length_obs=len(obs)
return(np.asarray(obs[:min(np.shape(Y)[1],length_obs)]))
```

and then the same trick for the likelihood:

```
# Priors for unknown model parameters
alpha = pm.Normal('alpha', mu=5500, sd=1000) #real is 6000
sigma = pm.HalfNormal('sigma', sd=1000)
# Expected value of outcome
test = proc_test(alpha)
# Likelihood of observations
Y_obs = pm.Normal('Y_obs', mu=test, sd=sigma, observed=Y[0,:min(np.shape(Y)[1],length_obs)])
# Inference
step = pm.Metropolis(scaling=100)
start={'alpha':5500, 'sigma':1}
trace = pm.sample(100,step=step,start=start)
```

but as I said it returns an error after the second step. I checked with the debugger and I feel like once length_obs is fixed in the likelihood definition (by the start value, at 1159 in my case), it is not really changed to 1164 like in a loop for instance.

Is there a way to deal with this kind of situation? I could not find anything so far.

Thanks!