code: def test_bfgs_sample():
      dim, history = 12, 2
      position_diffs = jnp.ones((dim, history))
      gradient_diffs = jnp.ones((dim, history))
      (
          diagonal_estimate,
          thin_factors,
          scaling_outer_product,
      ) = pathfinder.bfgs_inverse_hessian(
          updates_of_position_differences=position_diffs,
          updates_of_gradient_differences=gradient_diffs,
      )
      log_density = lambda x: jnp.sum(-x * x)
      grad_log_density = jax.grad(log_density)
  
      value = jnp.ones(dim)
  
      key = jax.random.PRNGKey(0)
      num_draws = 5
      draws, probs = pathfinder.bfgs_sample(
          value=value,
          grad_density=grad_log_density(value),
          diagonal_estimate=diagonal_estimate,
          thin_factors=thin_factors,
          scaling_outer_product=scaling_outer_product,
          num_draws=num_draws,
          key=key,
      )
      assert draws.shape[0] == num_draws
      assert draws.shape[1] == dim
      assert probs.shape[0] == num_draws
  
file_path: probability/discussion/pathfinder/pathfinder_test.py
imports: import jax
  import jax.numpy
  import numpy
  import pytest
  from discussion.pathfinder import pathfinder
  import tensorflow_probability.substrates.jax
label_desc: Use image node_id 4 for calling a global function with example usage: test_bfgs_sample() without return types