code: def main(args):
      pyro.set_rng_seed(0)
  
      optim = Adam({"lr": 0.1})
      inference = SVI(model, guide, optim, loss=Trace_ELBO())
  
      # Data is an arbitrary json-like structure with tensors at leaves.
      one = torch.tensor(1.0)
      data = {
          "foo": one,
          "bar": [0 * one, 1 * one, 2 * one],
          "baz": {
              "noun": {
                  "concrete": 4 * one,
                  "abstract": 6 * one,
              },
              "verb": 2 * one,
          },
      }
  
      print("Step\tLoss")
      loss = 0.0
      for step in range(args.num_epochs):
          loss += inference.step(data)
          if step and step % 10 == 0:
              print("{}\t{:0.5g}".format(step, loss))
              loss = 0.0
  
      print("Parameters:")
      for name, value in sorted(pyro.get_param_store().items()):
          print("{} = {}".format(name, value.detach().cpu().numpy()))
  
file_path: pyro/examples/contrib/autoname/tree_data.py
imports: import argparse
  import torch
  from torch.distributions import constraints
  import pyro
  import pyro.distributions
  from pyro.contrib.autoname import named
  from pyro.infer import SVI, Trace_ELBO
  from pyro.optim import Adam
label_desc: Use image node_id 5 for calling a global function with example usage: main(args) without return types