I figured out that the problem is this line:
def evolve(prev_p):
return pm.Binomial.dist(popsize,prev_p).random()/popsize
In particular, theano does not like the use of pm.Binomial.dist()… A deterministic function works fine.
So the question is, How do i get random numbers inside a function that will be used by theano.scan() ?