code: def step(self, *args, **kwargs):
      # This wraps both the call to `model` and `guide` in a `trace` so that
      # we can record all the parameters that are encountered. Note that
      # further tracing occurs inside of `loss`.
      with trace() as param_capture:
          # We use block here to allow tracing to record parameters only.
          with block(hide_fn=lambda msg: msg["type"] == "sample"):
              loss = self.loss(self.model, self.guide, *args, **kwargs)
      # Differentiate the loss.
      loss.backward()
      # Grab all the parameters from the trace.
      params = [
          site["value"].unconstrained()
          for site in param_capture.values()
      ]
      # Take a step w.r.t. each parameter in params.
      self.optim(params)
      # Zero out the gradients so that they don't accumulate.
      for p in params:
          p.grad = torch.zeros_like(p)
      return loss.item()
  
imports: import random
  import warnings
  import weakref
  from collections import OrderedDict
  import numpy
  import torch
  from pyro.distributions import validation_enabled
label_desc: Use image node_id 2 for calling the SVI obj's underlying member method code with example usage: obj.step() and returns: loss