code: def _make_val_and_grad_fn(value_fn):
      def val_and_grad(x):
          return gradient.value_and_gradient(value_fn, x)
  
      return val_and_grad
  
imports: from absl.testing import parameterized
  import numpy
  from scipy.stats import special_ortho_group
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.optimizer import bfgs
  from tensorflow_probability.python.optimizer import bfgs_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _make_val_and_grad_fn(value_fn) and returns: val_and_grad, gradient