code: def test_leapfrog_reversible():
      n = 3
      np.random.seed(42)
      start, model, _ = models.non_normal(n)
      size = sum(start[n.name].size for n in model.value_vars)
      scaling = floatX(np.random.rand(size))
  
      class HMC(BaseHMC):
          def _hamiltonian_step(self, *args, **kwargs):
              pass
  
      step = HMC(vars=model.value_vars, model=model, scaling=scaling)
  
      step.integrator._logp_dlogp_func.set_extra_values({})
      astart = DictToArrayBijection.map(start)
      p = RaveledVars(
          floatX(step.potential.random()), astart.point_map_info
      )
      q = RaveledVars(
          floatX(np.random.randn(size)), astart.point_map_info
      )
      start = step.integrator.compute_state(p, q)
      for epsilon in [0.01, 0.1]:
          for n_steps in [1, 2, 3, 4, 20]:
              state = start
              for _ in range(n_steps):
                  state = step.integrator.step(epsilon, state)
              for _ in range(n_steps):
                  state = step.integrator.step(-epsilon, state)
              npt.assert_allclose(state.q.data, start.q.data, rtol=1e-5)
              npt.assert_allclose(state.p.data, start.p.data, rtol=1e-5)
  
file_path: pymc/tests/step_methods/hmc/test_hmc.py
imports: import warnings
  import numpy
  import numpy.testing
  import pytest
  import pymc
  from pymc.blocking import DictToArrayBijection, RaveledVars
  from pymc.pytensorf import floatX
  from pymc.step_methods.hmc import HamiltonianMC
  from pymc.step_methods.hmc.base_hmc import BaseHMC
  from tests import models
  from tests.helpers import RVsAssignmentStepsTester, StepMethodTester
label_desc: Use image node_id 1 for calling a global function with example usage: test_leapfrog_reversible() without return types