code: def check_elbo(model, guide, Elbo):
      elbo = Elbo(num_particles=2, vectorize_particles=False)
      pyro.set_rng_seed(123)
      loss1 = elbo.loss(model, guide)
      pyro.set_rng_seed(123)
      loss2 = elbo.loss_and_grads(model, guide)
      assert_close(loss1, loss2)
  
      elbo = Elbo(num_particles=10000, vectorize_particles=True)
      loss1 = elbo.loss(model, guide)
      loss2 = elbo.loss_and_grads(model, guide)
      assert_close(loss1, loss2, atol=0.1)
  
file_path: pyro/tests/infer/test_multi_sample_elbos.py
imports: import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro.infer import RenyiELBO
  from tests.common import assert_close
label_desc: Use image node_id 1 for calling a global function with example usage: check_elbo(model, guide, Elbo) without return types