code: def test_svi_multi():
      args = make_args()
      args.assignment_grad = True
      detections = generate_data(args)
  
      pyro.clear_param_store()
      pyro.param(
          "noise_scale",
          torch.tensor(args.init_noise_scale),
          constraint=constraints.positive,
      )
      pyro.param("objects_loc", torch.randn(args.max_num_objects, 1))
  
      # Learn object_loc via Newton and noise_scale via Adam.
      elbo = TraceEnum_ELBO(max_plate_nesting=2)
      adam = Adam({"lr": 0.1})
      newton = Newton(trust_radii={"objects_loc": 1.0})
      optim = MixedMultiOptimizer(
          [(["noise_scale"], adam), (["objects_loc"], newton)]
      )
      for svi_step in range(50):
          with poutine.trace(param_only=True) as param_capture:
              loss = elbo.differentiable_loss(
                  model, guide, detections, args
              )
          params = {
              name: pyro.param(name).unconstrained()
              for name in param_capture.trace.nodes.keys()
          }
          optim.step(loss, params)
          logger.debug(
              "step {: >2d}, loss = {:0.6f}, noise_scale = {:0.6f}".format(
                  svi_step,
                  loss.item(),
                  pyro.param("noise_scale").item(),
              )
          )
  
imports: import logging
  import math
  import pytest
  import torch
  from torch.distributions import constraints
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.contrib.tracking.assignment import MarginalAssignment
  from pyro.infer import SVI, TraceEnum_ELBO
  from pyro.optim import Adam
  from pyro.optim.multi import MixedMultiOptimizer, Newton
label_desc: Use image node_id 9 for calling a global function with example usage: test_svi_multi() without return types