tf_agents.trajectories.from_transition
Stay organized with collections
Save and categorize content based on your preferences.
Returns a Trajectory
given transitions.
tf_agents.trajectories.from_transition(
time_step: tf_agents.trajectories.TimeStep
,
action_step: tf_agents.trajectories.PolicyStep
,
next_time_step: tf_agents.trajectories.TimeStep
) -> tf_agents.trajectories.Trajectory
Used in the notebooks
from_transition
is used by a driver to convert sequence of transitions into
a Trajectory
for efficient storage. Then an agent (e.g.
ppo_agent.PPOAgent
) converts it back to transitions by invoking
to_transition
.
Note that this method does not add a time dimension to the Tensors in the
resulting Trajectory
. This means that if your transitions don't already
include a time dimension, the Trajectory
cannot be passed to
agent.train()
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.trajectories.from_transition\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/trajectories/trajectory.py#L614-L647) |\n\nReturns a `Trajectory` given transitions.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf_agents.trajectories.trajectory.from_transition`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/from_transition)\n\n\u003cbr /\u003e\n\n tf_agents.trajectories.from_transition(\n time_step: ../../tf_agents/trajectories/TimeStep,\n action_step: ../../tf_agents/trajectories/PolicyStep,\n next_time_step: ../../tf_agents/trajectories/TimeStep\n ) -\u003e ../../tf_agents/trajectories/Trajectory\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|---------------------------------------------------------------------------------|\n| - [DQN C51/Rainbow](https://www.tensorflow.org/agents/tutorials/9_c51_tutorial) |\n\n`from_transition` is used by a driver to convert sequence of transitions into\na `Trajectory` for efficient storage. Then an agent (e.g.\n[`ppo_agent.PPOAgent`](../../tf_agents/agents/PPOAgent)) converts it back to transitions by invoking\n`to_transition`.\n\nNote that this method does not add a time dimension to the Tensors in the\nresulting `Trajectory`. This means that if your transitions don't already\ninclude a time dimension, the `Trajectory` cannot be passed to\n`agent.train()`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `time_step` | A [`time_step.TimeStep`](../../tf_agents/trajectories/TimeStep) representing the first step in a transition. |\n| `action_step` | A [`policy_step.PolicyStep`](../../tf_agents/trajectories/PolicyStep) representing actions corresponding to observations from time_step. |\n| `next_time_step` | A [`time_step.TimeStep`](../../tf_agents/trajectories/TimeStep) representing the second step in a transition. |\n\n\u003cbr /\u003e"]]