Hi Yamaguchi, could you say a little bit about why you want a scan function here? It doesn’t look like you are doing any recursive computation. The result of each loop doesn’t depend on the previous symbol. In that case, you can just specify you want 10 draws from a categorical distribution with something like:
with pm.Model():
t = pm.Beta('t',alpha=2, beta=1, shape=3)
symbol = pm.Categorical('symbol',t,shape=10)
pm.Deterministic("final_symbol", symbol[-1])
idata = pm.sample_prior_predictive(10)
If I was a bit more clear on your intentions, I think it would be easier to clean up the scan function.