code: def test_csis_sampling():
      pyro.clear_param_store()
      guide = Guide()
      csis = pyro.infer.CSIS(
          model, guide, pyro.optim.Adam({}), num_inference_samples=500
      )
      # observations chosen so that proposal distribution and true posterior will both have zero mean
      posterior = csis.run(
          {"y1": torch.tensor(-1.0), "y2": torch.tensor(1.0)}
      )
      assert_equal(len(posterior.exec_traces), 500)
      marginal = pyro.infer.EmpiricalMarginal(posterior, "x")
      assert_equal(marginal.mean, torch.tensor(0.0), prec=0.1)
  
file_path: pyro/tests/infer/test_csis.py
imports: import pytest
  import torch
  import torch.nn
  import pyro
  import pyro.distributions
  import pyro.infer
  import pyro.optim
  from tests.common import assert_equal, assert_not_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_csis_sampling() without return types