class maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord(*args, **kwds)

Holds structured spaces records (i.e., raw actions and observations recorded during a rollout).

property actions

Convenience access to all structured action dicts from this trajectory.

property actions_dicts

Convenience access to all structured action dicts from this trajectory.

TODO: Does not support multi agent scenarios (where the substep (dict) key is the same for all agents)

This method is only used in alpha zero though.


Convenience method for checking whether the end of this trajectory represents also the end of an episode.


Stack the whole trajectory into a single structured spaces record.

Useful for processing whole fixed-length trajectories in a single batch.

classmethod stack_trajectories(trajectories: List[SpacesTrajectoryRecord])maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord

Stack multiple trajectories, keeping the time dimension intact.

All the trajectories should be of the same length. The resulting trajectory will have the same number of steps, each being a stack of the corresponding steps of the input trajectories.


trajectories – Trajectories to stack.


Trajectory record of the same lenght, consisting of stacked structured spaces records.


Convenience method for calculating the total reward of a given trajectory.