What is the difference if a plate A is defined outside another plate B then use A inner B VS. the plate A is defined inner another plate B directly

The code in the HMM tutorial is confusing.

tones_plate = pyro.plate("tones", data_dim, dim=-1)
with pyro.plate("sequences", num_sequences, batch_size, dim=-2) as batch ...

As you can see, the tones_plate is defined outside the sequences plate. But my understanding is that, why don’t define the tones plate in the sequences plate like:

with pyro.plate("sequences"...)
    some code
    for t in range(1,T_max+1):
        with pyro.plate("tones_{}".format(t),...)
            some code

pyro.plate is a context manager. the two are equivalent.

Hi @jpchen, many thanks! I feel relaxed now as they are equivalent. :smile: