code: def testReplayBufferObservers(self):
      (
          traj,
          time_step_spec,
          action_spec,
      ) = driver_test_utils.make_random_trajectory()
      policy = driver_test_utils.TFPolicyMock(
          time_step_spec, action_spec
      )
      replay = trajectory_replay.TrajectoryReplay(policy)
      output_actions, output_policy_info, _ = replay.run(traj)
      new_traj = traj._replace(
          action=output_actions, policy_info=output_policy_info
      )
      repeat_output_actions, repeat_output_policy_info, _ = replay.run(
          new_traj
      )
      self.evaluate(tf.compat.v1.global_variables_initializer())
      (
          output_actions,
          output_policy_info,
          traj,
          repeat_output_actions,
          repeat_output_policy_info,
      ) = self.evaluate(
          (
              output_actions,
              output_policy_info,
              traj,
              repeat_output_actions,
              repeat_output_policy_info,
          )
      )
  
      # Ensure output actions & policy info don't match original trajectory.
      self._compare_to_original(
          output_actions, output_policy_info, traj
      )
  
      # Ensure repeated run with the same deterministic policy recreates the same
      # actions & policy info.
      tf.nest.map_structure(
          self.assertAllEqual, output_actions, repeat_output_actions
      )
      tf.nest.map_structure(
          self.assertAllEqual,
          output_policy_info,
          repeat_output_policy_info,
      )
  
file_path: agents/tf_agents/environments/trajectory_replay_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  from tf_agents.drivers import test_utils
  from tf_agents.environments import trajectory_replay
  from tf_agents.utils import test_utils
label_desc: Use image node_id 2 for calling the TrajectoryReplayTest obj's underlying member method code with example usage: obj.testReplayBufferObservers() without return types