code: def trace(fn=None, ignore_warnings=False, jit_options=None):
      """
      Lazy replacement for :func:`torch.jit.trace` that works with
      Pyro functions that call :func:`pyro.param`.
  
      The actual compilation artifact is stored in the ``compiled`` attribute of
      the output. Call diagnostic methods on this attribute.
  
      Example::
  
          def model(x):
              scale = pyro.param("scale", torch.tensor(0.5), constraint=constraints.positive)
              return pyro.sample("y", dist.Normal(x, scale))
  
          @pyro.ops.jit.trace
          def model_log_prob_fn(x, y):
              cond_model = pyro.condition(model, data={"y": y})
              tr = pyro.poutine.trace(cond_model).get_trace(x)
              return tr.log_prob_sum()
  
      :param callable fn: The function to be traced.
      :param bool ignore_warnins: Whether to ignore jit warnings.
      :param dict jit_options: Optional dict of options to pass to
          :func:`torch.jit.trace` , e.g. ``{"optimize": False}``.
      """
      if fn is None:
          return lambda fn: trace(
              fn,
              ignore_warnings=ignore_warnings,
              jit_options=jit_options,
          )
      return CompiledFunction(
          fn, ignore_warnings=ignore_warnings, jit_options=jit_options
      )
  
file_path: pyro/pyro/ops/jit.py
imports: import argparse
  import warnings
  import weakref
  import torch
  import pyro
  import pyro.poutine
  from pyro.util import ignore_jit_warnings, optional, timed
label_desc: Use image node_id 3 for calling a global function with example usage: trace(fn, ignore_warnings, jit_options) and returns: CompiledFunction, function