code: def test_potential_fn_pickling(jit):
      data = dist.Bernoulli(torch.tensor([0.8, 0.2])).sample(
          sample_shape=(torch.Size((1000,)))
      )
      _, potential_fn, _, _ = initialize_model(
          _beta_bernoulli,
          (data,),
          jit_compile=jit,
          skip_jit_warnings=True,
      )
      test_data = {"p_latent": torch.tensor([0.2, 0.6])}
      buffer = io.BytesIO()
      torch.save(potential_fn, buffer)
      buffer.seek(0)
      deser_potential_fn = torch.load(buffer)
      assert_close(
          deser_potential_fn(test_data), potential_fn(test_data)
      )
  
imports: import io
  import logging
  import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer import config_enumerate
  from pyro.infer.mcmc import HMC, NUTS
  from pyro.infer.mcmc.api import MCMC
  from pyro.infer.mcmc.util import TraceEinsumEvaluator, TraceTreeEvaluator, initialize_model
  from pyro.infer.reparam import LatentStableReparam
  from pyro.poutine.subsample_messenger import _Subsample
  from tests.common import assert_close, assert_equal, xfail_param
label_desc: Use image node_id 16 for calling a global function with example usage: test_potential_fn_pickling(jit) without return types