class_docstr: A helper that replays a policy against given `Trajectory` observations.
class_docstr_tok: ["A","helper","that","replays","a","policy","against","given","`","Trajectory","`","observations","."]
docstr: Creates a TrajectoryReplay object.
  
  TrajectoryReplay.run returns the actions and policy info of the new policy
  assuming it saw the observations from the given trajectory.
  
  Args:
    policy: A tf_policy.TFPolicy policy.
    time_major: If `True`, the tensors in `trajectory` passed to method `run`
      are assumed to have shape `[time, batch, ...]`.  Otherwise (default)
      they are assumed to have shape `[batch, time, ...]`.
  
  Raises:
    ValueError:
      If policy is not an instance of tf_policy.TFPolicy.
docstr_tok: ["Creates","a","TrajectoryReplay","object",".","TrajectoryReplay.run","returns","the","actions","and","policy","info","of","the","new","policy","assuming","it","saw","the","observations","from","the","given","trajectory",".","Args",":","policy",":","A","tf_policy.TFPolicy","policy",".","time_major",":","If","`","True","`",",","the","tensors","in","`","trajectory","`","passed","to","method","`","run","`","are","assumed","to","have","shape","`","[","time",",","batch",",","...","]","`",".","Otherwise","(","default",")","they","are","assumed","to","have","shape","`","[","batch",",","time",",","...","]","`",".","Raises",":","ValueError",":","If","policy","is","not","an","instance","of","tf_policy.TFPolicy","."]
code: def __init__(self, policy, time_major=False):
      """Creates a TrajectoryReplay object.
  
      TrajectoryReplay.run returns the actions and policy info of the new policy
      assuming it saw the observations from the given trajectory.
  
      Args:
        policy: A tf_policy.TFPolicy policy.
        time_major: If `True`, the tensors in `trajectory` passed to method `run`
          are assumed to have shape `[time, batch, ...]`.  Otherwise (default)
          they are assumed to have shape `[batch, time, ...]`.
  
      Raises:
        ValueError:
          If policy is not an instance of tf_policy.TFPolicy.
      """
      self._policy = policy
      self._time_major = time_major
  
file_path: agents/tf_agents/environments/trajectory_replay.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow
  from tf_agents.trajectories import time_step
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new TrajectoryReplay object from inherited base classes: object with example: obj = TrajectoryReplay(policy, time_major)