gxm.Timestep#
- class Timestep(next_obs, action, info, reward, terminated, truncated, true_next_obs)#
Bases:
StepExtends
Stepwith episodic metadata.The “time” refers to episodic time: reward, termination, and truncation signals only exist in the context of an episode, and are meaningless for a pure world model.
Timesteprepresents one unit of time \((R_i, S_{i+1})\) within a bounded episode.In case of truncation,
true_next_obsholds the observation \(\hat{S}_{i+1}\) that would have been seen had the episode not been cut.- __init__(next_obs, action, info, reward, terminated, truncated, true_next_obs)#
Methods
__init__(next_obs, action, info, reward, ...)trajectory(first_obs)Convert a sequence of timesteps \((R_0, S_1, ..., S_n)\) with the first observation \(S_0\) into a trajectory \((S_0, A_0, R_0, S_1, ..., S_n)\).
transition(obs)Convert the current timestep \((R_t, S_{t+1})\) into a transition \((S_t, A_t, R_t, S_{t+1})\) given the previous observation \(S_t\).
Attributes
Whether the episode has terminated or been truncated.
The reward \(R_i\) received at this timestep.
Whether the episode has terminated at this timestep.
Whether the episode has been truncated at this timestep.
The true next observation before any auto-reset.
next_obsThe observation at the next state.
actionThe action taken at this step.
infoAdditional information about the step.
- property done: Array#
Whether the episode has terminated or been truncated.
-
reward:
Array# The reward \(R_i\) received at this timestep.
-
terminated:
Array# Whether the episode has terminated at this timestep.
- trajectory(first_obs)#
Convert a sequence of timesteps \((R_0, S_1, ..., S_n)\) with the first observation \(S_0\) into a trajectory \((S_0, A_0, R_0, S_1, ..., S_n)\).
- Parameters:
first_obs (
Any) – The observation at the first timestep.- Return type:
- Returns:
A Trajectory object containing the sequence of timesteps.
- transition(obs)#
Convert the current timestep \((R_t, S_{t+1})\) into a transition \((S_t, A_t, R_t, S_{t+1})\) given the previous observation \(S_t\). :type obs:
Any:param obs: The observation at the previous timestep.- Return type:
- Returns:
A Transition object containing the current and next timesteps.
-
true_next_obs:
Any# The true next observation before any auto-reset. Differs from
next_obsonly whentruncatedis True.
-
truncated:
Array# Whether the episode has been truncated at this timestep.