LDA implementation with pymc3

Thanks @junpenglao. It worked well. But when I am trying to sample it using

with model:    
step1 = pm.Metropolis()
tr = pm.sample(1000,step = step1, chains=1)

I am getting this error. Shaping and Reshaping seems to work fine in this case.

IndexError: index 3 is out of bounds for size 2
Apply node that caused the error: AdvancedSubtensor1(phis, Subtensor{int64:int64:}.0)