SpacesRecord¶
- class maze.core.trajectory_recording.records.spaces_record.SpacesRecord(actor_id: ActorID, observation: Dict[str, numpy.ndarray | torch.Tensor] | None = None, action: Dict[str, numpy.ndarray | torch.Tensor] | None = None, reward: float | numpy.ndarray | torch.Tensor | None = None, done: bool | numpy.ndarray | torch.Tensor | None = None, info: Dict | None = None, next_observation: Dict[str, numpy.ndarray | torch.Tensor] | None = None, logits: Dict[str, numpy.ndarray] | None = None, discounted_return: float | numpy.ndarray | None = None, batch_shape: List[int] | None = None, policy_record: object | None = None, env_time: int | None = None)¶
Record of spaces (i.e., raw action, observation, and associated data) from a single sub-step.
- action: Dict[str, numpy.ndarray | torch.Tensor] | None = None¶
Action recorded during the step.
- discounted_return: float | numpy.ndarray | None = None¶
Discounted return for this step.
- done: bool | numpy.ndarray | torch.Tensor | None = None¶
Done flag recorded during the step.
- env_time: int | None = None¶
The env time (t) of the env when recording the observation such that: (s_t, a_t, v_t) -> env step -> (r_t, done_t, info_t) is recorded.
- logits: Dict[str, numpy.ndarray] | None = None¶
Action logits recorded during the step.
- next_observation: Dict[str, numpy.ndarray | torch.Tensor] | None = None¶
Observation obtained after this step (i.e., results of the action taken in this step).
- observation: Dict[str, numpy.ndarray | torch.Tensor] | None = None¶
Observation recorded during the step.
- policy_record: object | None = None¶
Policy specific data that can be recorded with the help of the write_policy_record method of the policy.
- reward: float | numpy.ndarray | torch.Tensor | None = None¶
Reward recorded during the step.
- classmethod stack(records: List[SpacesRecord]) 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.
- to_numpy() SpacesRecord¶
Convert the record to numpy.
- to_torch(device: str) SpacesRecord¶
Convert the record to Torch.
- Parameters:
device – Device to move the tensors to.