code: def test_loss(Elbo):
      pyro.clear_param_store()
      data = torch.tensor(1.0)
  
      def model(data):
          loc = pyro.sample("loc", dist.Normal(0, 1))
          scale = pyro.sample("scale", dist.LogNormal(0, 1))
          pyro.sample("obs", dist.Normal(loc, scale), obs=data)
  
      def guide(data):
          loc_loc = pyro.param("loc_loc", lambda: torch.tensor(1.0))
          scale_loc = pyro.param(
              "scale_loc", lambda: torch.tensor(-1.0)
          )
          pyro.sample("loc", dist.Normal(loc_loc, 2))
          pyro.sample("scale", dist.LogNormal(scale_loc, 0.1))
  
      elbo = Elbo(
          num_particles=10_000,
          vectorize_particles=True,
          max_plate_nesting=0,
          strict_enumeration_warning=False,
      )
      expected = 18.611
  
      try:
          actual = elbo.loss(model, guide, data)
          assert_close(actual, expected, rtol=0.1)
      except NotImplementedError:
          pass
  
      actual = elbo.loss_and_grads(model, guide, data)
      assert_close(actual, expected, rtol=0.1)
  
imports: import logging
  import warnings
  import pytest
  import torch
  from torch.autograd import grad
  from torch.distributions import constraints, kl_divergence
  import pyro
  import pyro.distributions
  import pyro.ops.jit
  import pyro.poutine
  from pyro.distributions.util import scale_and_mask
  from pyro.infer import SVI, JitTrace_ELBO, JitTraceEnum_ELBO, JitTraceGraph_ELBO, JitTraceMeanField_ELBO, Trace_ELBO, TraceEnum_ELBO, TraceGraph_ELBO, TraceMeanField_ELBO, TraceTMC_ELBO, infer_discrete
  from pyro.optim import Adam
  from pyro.poutine.indep_messenger import CondIndepStackFrame
  from pyro.util import ignore_jit_warnings
  from tests.common import assert_close, assert_equal
label_desc: Use image node_id 14 for calling a global function with example usage: test_loss(Elbo) without return types