SpacesRecord¶
-
class
maze.core.trajectory_recording.records.spaces_record.
SpacesRecord
(actor_id: maze.core.env.structured_env.ActorID, observation: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None, action: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None, reward: Optional[Union[float, numpy.ndarray, torch.Tensor]] = None, done: Optional[Union[bool, numpy.ndarray, torch.Tensor]] = None, info: Optional[Dict] = None, next_observation: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None, logits: Optional[Dict[str, numpy.ndarray]] = None, discounted_return: Optional[Union[float, numpy.ndarray]] = None, batch_shape: Optional[List[int]] = None)¶ Record of spaces (i.e., raw action, observation, and associated data) from a single sub-step.
-
action
: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None¶ Action recorded during the step.
-
actor_id
: maze.core.env.structured_env.ActorID¶ ID of the actor for this step.
-
property
agent_id
¶ Sub-step key (i.e., the second part of the Actor ID) for this step.
-
discounted_return
: Optional[Union[float, numpy.ndarray]] = None¶ Discounted return for this step.
-
done
: Optional[Union[bool, numpy.ndarray, torch.Tensor]] = None¶ Done flag recorded during the step.
-
info
: Optional[Dict] = None¶ Info dictionary recorded during the step.
-
logits
: Optional[Dict[str, numpy.ndarray]] = None¶ Action logits recorded during the step.
-
next_observation
: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None¶ Observation obtained after this step (i.e., results of the action taken in this step).
-
observation
: Optional[Dict[str, Union[numpy.ndarray, torch.Tensor]]] = None¶ Observation recorded during the step.
-
reward
: Optional[Union[float, numpy.ndarray, torch.Tensor]] = None¶ Reward recorded during the step.
-
classmethod
stack
(records: List[SpacesRecord]) → maze.core.trajectory_recording.records.spaces_record.SpacesRecord¶ Stack multiple records into a single spaces record. Useful for processing multiple records in a batch.
All the records should be in numpy and have the same structure of the spaces (i.e. come from the same environment etc.).
- Parameters
records – Records to stack.
- Returns
Single stacked record, containing all the given records, and having the corresponding batch shape.
-
property
substep_key
¶ Sub-step key (i.e., the first part of the Actor ID) for this step.
-
to_numpy
() → maze.core.trajectory_recording.records.spaces_record.SpacesRecord¶ Convert the record to numpy.
-
to_torch
(device: str) → maze.core.trajectory_recording.records.spaces_record.SpacesRecord¶ Convert the record to Torch.
- Parameters
device – Device to move the tensors to.
-