class_docstr: Test class for FiniteDifferenceHvp
class_docstr_tok: ["Test","class","for","FiniteDifferenceHvp"]
code: def test_pickleable(self):
      policy = HelperPolicy(n_vars=1)
      x = policy.get_params()[0]
      a_val = np.array([5.0])
      a = tf.constant([0.0])
      f = a * (x**2)
      vector = np.array([10.0])
      reg_coeff = 1e-5
      hvp = FiniteDifferenceHVP()
  
      self.sess.run(tf.compat.v1.global_variables_initializer())
      hvp.update_hvp(f, policy, (a,), reg_coeff)
      hx = hvp.build_eval(np.array([a_val]))
      before_pickle = hx(vector)
  
      hvp = pickle.loads(pickle.dumps(hvp))
      hvp.update_hvp(f, policy, (a,), reg_coeff)
      after_pickle = hx(vector)
      assert np.equal(before_pickle, after_pickle)
  
imports: import pickle
  import numpy
  import pytest
  import tensorflow
  from garage.tf.models import Module
  from garage.tf.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer
  from garage.tf.optimizers.conjugate_gradient_optimizer import FiniteDifferenceHVP
  from garage.tf.optimizers.conjugate_gradient_optimizer import _cg, PearlmutterHVP
  from garage.tf.policies import Policy
  from tests.fixtures import TfGraphTestCase
label_desc: Use image node_id 4 for calling the TestFiniteDifferenceHVP obj's underlying member method code with example usage: obj.test_pickleable() without return types