code: def testInferenceFromCheckpoint(self):
      if not common.has_eager_been_enabled():
          self.skipTest("Only supported in TF2.x.")
  
      path = os.path.join(self.get_temp_dir(), "saved_policy")
      saver = policy_saver.PolicySaver(self.tf_policy)
      saver.save(path)
  
      rng = np.random.RandomState()
      sample_time_step = array_spec.sample_spec_nest(
          self.time_step_spec, rng
      )
      batched_sample_time_step = nest_utils.batch_nested_array(
          sample_time_step
      )
  
      self.evaluate(
          tf.nest.map_structure(
              lambda v: v.assign(v * 0 + -1), self.tf_policy.variables()
          )
      )
      checkpoint_path = os.path.join(self.get_temp_dir(), "checkpoint")
      saver.save_checkpoint(checkpoint_path)
  
      eager_py_policy = py_tf_eager_policy.SavedModelPyTFEagerPolicy(
          path, self.time_step_spec, self.action_spec
      )
  
      # Use evaluate to force a copy.
      saved_model_variables = self.evaluate(eager_py_policy.variables())
  
      eager_py_policy.update_from_checkpoint(checkpoint_path)
  
      assert_np_not_equal = lambda a, b: self.assertFalse(
          np.equal(a, b).all()
      )
      tf.nest.map_structure(
          assert_np_not_equal,
          saved_model_variables,
          self.evaluate(eager_py_policy.variables()),
      )
  
      assert_np_all_equal = lambda a, b: self.assertTrue(
          np.equal(a, b).all()
      )
      tf.nest.map_structure(
          assert_np_all_equal,
          self.evaluate(self.tf_policy.variables()),
          self.evaluate(eager_py_policy.variables()),
          check_types=False,
      )
  
      # Can't check if the action is different as in some cases depending on
      # variable initialization it will be the same. Checking that they are at
      # least always the same.
      checkpoint_action = eager_py_policy.action(sample_time_step)
  
      current_policy_action = self.tf_policy.action(
          batched_sample_time_step
      )
      current_policy_action = self.evaluate(
          nest_utils.unbatch_nested_tensors(current_policy_action)
      )
      tf.nest.map_structure(
          assert_np_all_equal, current_policy_action, checkpoint_action
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.agents.ddpg import actor_network
  from tf_agents.environments import batched_py_environment
  from tf_agents.environments import random_py_environment
  from tf_agents.policies import actor_policy
  from tf_agents.policies import policy_saver
  from tf_agents.policies import py_tf_eager_policy
  from tf_agents.policies import random_tf_policy
  from tf_agents.specs import array_spec
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
  from tf_agents.utils import test_utils
label_desc: Use image node_id 6 for calling the SavedModelPYTFEagerPolicyTest obj's underlying member method code with example usage: obj.testInferenceFromCheckpoint() without return types