code: def model_0(data, history, vectorized):
      x_dim = 3
      init = pyro.param(
          "init",
          lambda: torch.rand(x_dim),
          constraint=constraints.simplex,
      )
      trans = pyro.param(
          "trans",
          lambda: torch.rand((x_dim, x_dim)),
          constraint=constraints.simplex,
      )
      locs = pyro.param("locs", lambda: torch.rand(x_dim))
  
      with pyro.plate("sequences", data.shape[0], dim=-3) as sequences:
          sequences = sequences[:, None]
          x_prev = None
          markov_loop = (
              pyro.vectorized_markov(
                  name="time",
                  size=data.shape[1],
                  dim=-2,
                  history=history,
              )
              if vectorized
              else pyro.markov(range(data.shape[1]), history=history)
          )
          for i in markov_loop:
              x_curr = pyro.sample(
                  "x_{}".format(i),
                  dist.Categorical(
                      init
                      if isinstance(i, int) and i < 1
                      else trans[x_prev]
                  ),
              )
              with pyro.plate("tones", data.shape[2], dim=-1):
                  pyro.sample(
                      "y_{}".format(i),
                      dist.Normal(Vindex(locs)[..., x_curr], 1.0),
                      obs=Vindex(data)[sequences, i],
                  )
              x_prev = x_curr
  
imports: import pytest
  import torch
  from pyroapi import pyro_backend
  from torch.distributions import constraints
  from pyro.ops.indexing import Vindex
label_desc: Use image node_id 1 for calling a global function with example usage: model_0(data, history, vectorized) without return types