Understanding how to use to_event in model

Hello devs.

I have a multivariate response model. I’m trying to model the responses independently. Here, response_arr is of size (100, 6) where I have 6 responses for each of the 100 data points. mu and beta are sample sites, which are also of size (100, 6).

I’m trying to understand difference between the two code snippets:

    ...
    with numpyro.plate("response_plate", 6, dim=-1):
        with numpyro.plate("data_plate", 100, dim=-2):
            numpyro.sample(
                "obs",
                dist.Normal(loc=mu, scale=1 / beta),
                obs=response_arr
            )

versus

    ...
    with numpyro.plate("data_plate", 100):
        numpyro.sample(
            "obs",
            dist.Normal(loc=mu, scale=1 / beta).to_event(1),
            obs=response_arr
        )

Could you please tell me if these are equivalent? If not, which is the preferred method?

1 Like

This might answer your question: Tensor shapes in Pyro — Pyro Tutorials 1.8.6 documentation