code: def model(data=None, args=None, batch_size=None):
      # Globals.
      with pyro.plate("topics", args.num_topics):
          topic_weights = pyro.sample(
              "topic_weights", dist.Gamma(1.0 / args.num_topics, 1.0)
          )
          topic_words = pyro.sample(
              "topic_words",
              dist.Dirichlet(
                  torch.ones(args.num_words) / args.num_words
              ),
          )
  
      # Locals.
      with pyro.plate("documents", args.num_docs) as ind:
          if data is not None:
              with pyro.util.ignore_jit_warnings():
                  assert data.shape == (
                      args.num_words_per_doc,
                      args.num_docs,
                  )
              data = data[:, ind]
          doc_topics = pyro.sample(
              "doc_topics", dist.Dirichlet(topic_weights)
          )
          with pyro.plate("words", args.num_words_per_doc):
              # The word_topics variable is marginalized out during inference,
              # achieved by specifying infer={"enumerate": "parallel"} and using
              # TraceEnum_ELBO for inference. Thus we can ignore this variable in
              # the guide.
              word_topics = pyro.sample(
                  "word_topics",
                  dist.Categorical(doc_topics),
                  infer={"enumerate": "parallel"},
              )
              data = pyro.sample(
                  "doc_words",
                  dist.Categorical(topic_words[word_topics]),
                  obs=data,
              )
  
      return topic_weights, topic_words, data
  
file_path: pyro/examples/lda.py
imports: import argparse
  import functools
  import logging
  import torch
  from torch import nn
  from torch.distributions import constraints
  import pyro
  import pyro.distributions
  from pyro.infer import SVI, JitTraceEnum_ELBO, TraceEnum_ELBO
  from pyro.optim import ClippedAdam
label_desc: Use image node_id 1 for calling a global function with example usage: model(data, args, batch_size) and returns: topic_weights,  topic_words,  data