code: def model_recurse(data, latent):
      if torch.is_tensor(data):
          latent.x.sample_(dist.Normal(latent.z, 1.0), obs=data)
      elif isinstance(data, list):
          latent.prior_scale.param_(
              torch.tensor(1.0), constraint=constraints.positive
          )
          latent.list = named.List()
          for data_i in data:
              latent_i = latent.list.add()
              latent_i.z.sample_(
                  dist.Normal(latent.z, latent.prior_scale)
              )
              model_recurse(data_i, latent_i)
      elif isinstance(data, dict):
          latent.prior_scale.param_(
              torch.tensor(1.0), constraint=constraints.positive
          )
          latent.dict = named.Dict()
          for key, value in data.items():
              latent.dict[key].z.sample_(
                  dist.Normal(latent.z, latent.prior_scale)
              )
              model_recurse(value, latent.dict[key])
      else:
          raise TypeError("Unsupported type {}".format(type(data)))
  
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 2 for calling a global function with example usage: model_recurse(data, latent) without return types