class_docstr: Test class for ConjugateGradientOptimizer and HVP classes
class_docstr_tok: ["Test","class","for","ConjugateGradientOptimizer","and","HVP","classes"]
code: def test_pickleable(self):
      policy = HelperPolicy(n_vars=1)
      x = policy.get_params()[0]
      a_val = np.array([5.0], dtype=np.float32)
      a = tf.constant(a_val)
      loss = a * (x**2)
      constraint = (loss, 0.0)
      self.sess.run(tf.compat.v1.global_variables_initializer())
      opt = ConjugateGradientOptimizer()
      opt.update_opt(loss, policy, constraint, [a])
      opt.optimize([a_val])
      loss_before = opt.loss([a_val])
      opt = pickle.loads(pickle.dumps(opt))
      opt.update_opt(loss, policy, constraint, [a])
      loss_after = opt.loss([a_val])
      assert np.equal(loss_before, loss_after)
  
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 2 for calling the TestConjugateGradientOptimizer obj's underlying member method code with example usage: obj.test_pickleable() without return types