Solved by biggerfish in post #2 
              
              
                Never mind, I forgot to delete an old vocab_size variable, which is much smaller than the actual size of vocabulary. After I delete it, the error is gone.