code: def guide(data):
      loc_eta = torch.randn(J)
      # note that we initialize our scales to be pretty narrow
      scale_eta = 0.1 * torch.rand(J)
      loc_mu = torch.randn(1)
      scale_mu = 0.1 * torch.rand(1)
      loc_logtau = torch.randn(1)
      scale_logtau = 0.1 * torch.rand(1)
  
      # register learnable params in the param store
      m_eta_param = pyro.param("loc_eta", loc_eta)
      s_eta_param = pyro.param(
          "scale_eta", scale_eta, constraint=constraints.positive
      )
      m_mu_param = pyro.param("loc_mu", loc_mu)
      s_mu_param = pyro.param(
          "scale_mu", scale_mu, constraint=constraints.positive
      )
      m_logtau_param = pyro.param("loc_logtau", loc_logtau)
      s_logtau_param = pyro.param(
          "scale_logtau", scale_logtau, constraint=constraints.positive
      )
  
      # guide distributions
      dist_eta = dist.Normal(m_eta_param, s_eta_param)
      dist_mu = dist.Normal(m_mu_param, s_mu_param)
      dist_tau = dist.TransformedDistribution(
          dist.Normal(m_logtau_param, s_logtau_param),
          transforms=transforms.ExpTransform(),
      )
  
      with pyro.plate("data", J):
          pyro.sample("eta", dist_eta)
          pyro.sample("mu", dist_mu)
          pyro.sample("tau", dist_tau)
  
file_path: pyro/examples/eight_schools/svi.py
imports: import argparse
  import logging
  import torch
  from data import J, sigma, y
  from torch.distributions import constraints, transforms
  import pyro
  import pyro.distributions
  from pyro.infer import SVI, JitTrace_ELBO, Trace_ELBO
  from pyro.optim import Adam
label_desc: Use image node_id 2 for calling a global function with example usage: guide(data) without return types