code: def test_sequential_consistent(run_mcmc_cls, monkeypatch):
      # test if there is no stuff left from the previous chain
      monkeypatch.setattr(torch.multiprocessing, "cpu_count", lambda: 1)
  
      class FirstKernel(NUTS):
          def setup(self, warmup_steps, *args, **kwargs):
              self._chain_id = (
                  0 if "_chain_id" not in self.__dict__ else 1
              )
              pyro.set_rng_seed(self._chain_id)
              super().setup(warmup_steps, *args, **kwargs)
  
      class SecondKernel(NUTS):
          def setup(self, warmup_steps, *args, **kwargs):
              self._chain_id = (
                  1 if "_chain_id" not in self.__dict__ else 0
              )
              pyro.set_rng_seed(self._chain_id)
              super().setup(warmup_steps, *args, **kwargs)
  
      data = torch.tensor([1.0])
      kernel = FirstKernel(normal_normal_model)
      samples1, _ = run_mcmc_cls(
          data,
          kernel,
          num_samples=100,
          warmup_steps=100,
          num_chains=2,
          group_by_chain=True,
      )
  
      kernel = SecondKernel(normal_normal_model)
      samples2, _ = run_mcmc_cls(
          data,
          kernel,
          num_samples=100,
          warmup_steps=100,
          num_chains=2,
          group_by_chain=True,
      )
  
      assert_close(samples1["y"][0], samples2["y"][1])
      assert_close(samples1["y"][1], samples2["y"][0])
  
imports: import os
  from functools import partial
  import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.infer.mcmc import HMC, NUTS
  from pyro.infer.mcmc.api import MCMC, StreamingMCMC, _MultiSampler, _UnarySampler
  from pyro.infer.mcmc.mcmc_kernel import MCMCKernel
  from pyro.infer.mcmc.util import initialize_model, select_samples
  from pyro.ops.streaming import StackStats, StatsOfDict
  from pyro.util import optional
  from tests.common import assert_close
label_desc: Use image node_id 10 for calling a global function with example usage: test_sequential_consistent(run_mcmc_cls, monkeypatch) without return types