# Module: tf_agents.trajectories

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/trajectories/__init__.py) |

Trajectories module.

## Modules

[`policy_step`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/policy_step) module: Policy Step.

[`time_step`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/time_step) module: TimeStep representing a step in the environment.

[`trajectory`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/trajectory) module: Trajectory containing time_step transition information.

## Classes

[`class PolicyInfo`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/PolicyInfo): PolicyInfo(log_probability,)

[`class PolicyStep`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/PolicyStep): Returned with every call to `policy.action()` and `policy.distribution()`.

[`class StepType`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/StepType): Defines the status of a `TimeStep` within a sequence.

[`class TimeStep`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/TimeStep): Returned with every call to `step` and `reset` on an environment.

[`class Trajectory`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/Trajectory): A tuple that represents a trajectory.

[`class Transition`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/Transition): A tuple that represents a transition.

## Functions

[`boundary(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/boundary): Create a Trajectory transitioning between StepTypes `LAST` and `FIRST`.

[`first(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/first): Create a Trajectory transitioning between StepTypes `FIRST` and `MID`.

[`from_transition(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/from_transition): Returns a `Trajectory` given transitions.

[`last(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/last): Create a Trajectory transitioning between StepTypes `MID` and `LAST`.

[`mid(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/mid): Create a Trajectory transitioning between StepTypes `MID` and `MID`.

[`restart(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/restart): Returns a `TimeStep` with `step_type` set equal to [`StepType.FIRST`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/StepType#FIRST).

[`single_step(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/single_step): Create a Trajectory transitioning between StepTypes `FIRST` and `LAST`.

[`termination(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/termination): Returns a `TimeStep` with `step_type` set to [`StepType.LAST`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/StepType#LAST).

[`time_step_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/time_step_spec): Returns a `TimeStep` spec given the observation_spec.

[`to_n_step_transition(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/to_n_step_transition): Create an n-step transition from a trajectory with `T=N + 1` frames.

[`to_transition(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/to_transition): Create a transition from a trajectory or two adjacent trajectories.

[`to_transition_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/to_transition_spec): Create a transition spec from a trajectory spec.

[`transition(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/transition): Returns a `TimeStep` with `step_type` set equal to [`StepType.MID`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/StepType#MID).

[`truncation(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/truncation): Returns a `TimeStep` with `step_type` set to [`StepType.LAST`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/StepType#LAST).