class_docstr: :param model: the model (callable containing Pyro primitives)
  :param guide: the guide (callable containing Pyro primitives)
  :param optim: a wrapper a for a PyTorch optimizer
  :type optim: ~pyro.optim.optim.PyroOptim
  :param loss: an instance of a subclass of :class:`~pyro.infer.elbo.ELBO`.
      Pyro provides three built-in losses:
      :class:`~pyro.infer.trace_elbo.Trace_ELBO`,
      :class:`~pyro.infer.tracegraph_elbo.TraceGraph_ELBO`, and
      :class:`~pyro.infer.traceenum_elbo.TraceEnum_ELBO`.
      See the :class:`~pyro.infer.elbo.ELBO` docs to learn how to implement
      a custom loss.
  :type loss: pyro.infer.elbo.ELBO
  :param num_samples: (DEPRECATED) the number of samples for Monte Carlo posterior approximation
  :param num_steps: (DEPRECATED) the number of optimization steps to take in ``run()``
  
  A unified interface for stochastic variational inference in Pyro. The most
  commonly used loss is ``loss=Trace_ELBO()``. See the tutorial
  `SVI Part I <http://pyro.ai/examples/svi_part_i.html>`_ for a discussion.
class_docstr_tok: [":","param","model",":","the","model","(","callable","containing","Pyro","primitives",")",":","param","guide",":","the","guide","(","callable","containing","Pyro","primitives",")",":","param","optim",":","a","wrapper","a","for","a","PyTorch","optimizer",":","type","optim",":","~pyro.optim.optim.PyroOptim",":","param","loss",":","an","instance","of","a","subclass","of",":","class",":","`","~pyro.infer.elbo.ELBO","`",".","Pyro","provides","three","built-in","losses",":",":","class",":","`","~pyro.infer.trace_elbo.Trace_ELBO","`",",",":","class",":","`","~pyro.infer.tracegraph_elbo.TraceGraph_ELBO","`",",","and",":","class",":","`","~pyro.infer.traceenum_elbo.TraceEnum_ELBO","`",".","See","the",":","class",":","`","~pyro.infer.elbo.ELBO","`","docs","to","learn","how","to","implement","a","custom","loss",".",":","type","loss",":","pyro.infer.elbo.ELBO",":","param","num_samples",":","(","DEPRECATED",")","the","number","of","samples","for","Monte","Carlo","posterior","approximation",":","param","num_steps",":","(","DEPRECATED",")","the","number","of","optimization","steps","to","take","in","``","run","(",")","``","A","unified","interface","for","stochastic","variational","inference","in","Pyro",".","The","most","commonly","used","loss","is","``","loss=Trace_ELBO","(",")","``",".","See","the","tutorial","`","SVI","Part","I","<","http",":","\/\/pyro.ai\/examples\/svi_part_i.html",">","`","_","for","a","discussion","."]
code: def _traces(self, *args, **kwargs):
      for i in range(self.num_samples):
          guide_trace = poutine.trace(self.guide).get_trace(
              *args, **kwargs
          )
          model_trace = poutine.trace(
              poutine.replay(self.model, trace=guide_trace)
          ).get_trace(*args, **kwargs)
          yield model_trace, 1.0
  
file_path: pyro/pyro/infer/svi.py
imports: import warnings
  import torch
  import pyro
  import pyro.optim
  import pyro.poutine
  from pyro.infer.abstract_infer import TracePosterior
  from pyro.infer.elbo import ELBO
  from pyro.infer.util import torch_item
label_desc: Use image node_id 3 for calling the SVI obj's underlying member method code with example usage: obj._traces() without return types