Can't declare an integer loop variable

I have been trying to get this one thing going for two days and read a lot of documentation. I am missing something very basic. I have a loop which I implement using theano.scan. It involves feeding an index i, which I want to start at 0. In the loop body I have a statement

day_prob_slice = prob_v[0, i, 0]

which appears fine by itself. However, by the time i gets to this statement, i got transformed into 0.0, a float or double, and the code bombs with TypeError: Expected an integer

I tried
x = 0
i = tt.as_tensor_variable(x, “loop_index”)
but, I don’t know how to force it to an integer

also
i = tt.lscalar('loop_index')

but, then I don’t know how to set its value, and it fails with
ValueError: Cannot compute test value: input 0 (loop_index) of Op Elemwise{Cast{float64}}(loop_index) missing default value.

The entry into the loop is
pm.DensityDist('lh', logp, observed={'i': i, 'visits': Y, 'x_logits' : N_x_logit, 'mu':mu})

Please give a clue how to do this.

I am starting to figure it out from this page http://deeplearning.net/software/theano/library/scan.html

so symbolic variables during scan declaration. real numpy arrays when calling the function.

You can set the test value like this:

i = tt.lscalar('loop_index')
i.tag.test_value=0

But in most case you don’t need index in theano scan, you just pass the sequence or the thing you would like to compute iterately as input

yes, I have figured out how to feed a sequence variable to feed to loop.