code: def assert_error(model, guide, elbo, match=None):
      """
      Assert that inference fails with an error.
      """
      inference = build_svi(model, guide, elbo)
      with pytest.raises(
          (
              NotImplementedError,
              UserWarning,
              KeyError,
              ValueError,
              RuntimeError,
          ),
          match=match,
      ):
          inference.step()
  
imports: import warnings
  import pytest
  import torch
  from pytest import approx
  from torch.distributions import constraints
  from pyro.generic import distributions
  from pyro.generic import infer, ops, optim, pyro, pyro_backend
  from tests.common import assert_close, xfail_param
label_desc: Use image node_id 3 for calling a global function with example usage: assert_error(model, guide, elbo, match) without return types