How to use enumerated sample sites inside a markov context to determine downstream structure

Hi~
I want to know how to use a enumerated discrete sample site inside a markov context in the downstream code. I have recently come across two errors which i believe is caused by not doing this properly, i read through the relevant tutorials and haven’t find helpful information.

The first error occurs when i want to use the a discrete variable of a certain time step to determine downstream structure using if-else. The second error occurs because i want to use this variabel to be the index of some tensor of a downstream sample sites.

If i missed some information in the tutorials, please give me some links~
Really appreciated any help.

You can use the “sequential” strategy at a given sample site:

x = pyro.sample("x", dist.Categorical(probs),
                infer={"enumerate": "sequential"})

Thanks for your help!
Actually in my first example I did sequential enumeration for the interested sample site at the guide side. Would you please run my code and help me find the answer if you have time, sorry for bothering.