code: def guide_generic(config):
      """generic mean-field guide for continuous random effects"""
      N_state = config["sizes"]["state"]
  
      if config["group"]["random"] == "continuous":
          loc_g = pyro.param(
              "loc_group", lambda: torch.zeros((N_state**2,))
          )
          scale_g = pyro.param(
              "scale_group",
              lambda: torch.ones((N_state**2,)),
              constraint=constraints.positive,
          )
  
      # initialize individual-level random effect parameters
      N_c = config["sizes"]["group"]
      if config["individual"]["random"] == "continuous":
          loc_i = pyro.param(
              "loc_individual",
              lambda: torch.zeros(
                  (
                      N_c,
                      N_state**2,
                  )
              ),
          )
          scale_i = pyro.param(
              "scale_individual",
              lambda: torch.ones(
                  (
                      N_c,
                      N_state**2,
                  )
              ),
              constraint=constraints.positive,
          )
  
      N_c = config["sizes"]["group"]
      with pyro.plate("group", N_c, dim=-1):
          if config["group"]["random"] == "continuous":
              pyro.sample(
                  "eps_g",
                  dist.Normal(loc_g, scale_g).to_event(1),
              )  # infer={"num_samples": 10})
  
          N_s = config["sizes"]["individual"]
          with pyro.plate("individual", N_s, dim=-2), poutine.mask(
              mask=config["individual"]["mask"]
          ):
              # individual-level random effects
              if config["individual"]["random"] == "continuous":
                  pyro.sample(
                      "eps_i",
                      dist.Normal(loc_i, scale_i).to_event(1),
                  )
  
file_path: pyro/examples/mixed_hmm/model.py
imports: import torch
  from torch.distributions import constraints
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.infer import config_enumerate
  from pyro.ops.indexing import Vindex
label_desc: Use image node_id 1 for calling a global function with example usage: guide_generic(config) without return types