code: def test_unnormalized_normal(kernel, jit):
      true_mean, true_std = torch.tensor(5.0), torch.tensor(1.0)
      init_params = {"z": torch.tensor(0.0)}
  
      def potential_energy(params):
          return 0.5 * torch.sum(
              ((params["z"] - true_mean) / true_std) ** 2
          )
  
      potential_fn = (
          potential_energy
          if not jit
          else torch.jit.trace(potential_energy, init_params)
      )
      hmc_kernel = kernel(model=None, potential_fn=potential_fn)
  
      samples = init_params
      warmup_steps = 400
      hmc_kernel.initial_params = samples
      hmc_kernel.setup(warmup_steps)
  
      for i in range(warmup_steps):
          samples = hmc_kernel(samples)
  
      posterior = []
      for i in range(2000):
          hmc_kernel.clear_cache()
          samples = hmc_kernel(samples)
          posterior.append(samples)
  
      posterior = torch.stack([sample["z"] for sample in posterior])
      assert_close(torch.mean(posterior), true_mean, rtol=0.05)
      assert_close(torch.std(posterior), true_std, rtol=0.05)
  
imports: import logging
  import os
  from collections import namedtuple
  import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro.infer.mcmc import NUTS
  from pyro.infer.mcmc.api import MCMC
  from pyro.infer.mcmc.hmc import HMC
  from tests.common import assert_close, assert_equal
label_desc: Use image node_id 10 for calling a global function with example usage: test_unnormalized_normal(kernel, jit) and returns: unknown