Esempio n. 1
0
    def __init__(
        self,
        get_observation: Callable[[ObservationRequest], Observation],
        spaces: List[ObservationSpace],
    ):
        if not spaces:
            raise ValueError("No observation spaces")
        self.spaces = {
            s.name: ObservationSpaceSpec.from_proto(i, s) for i, s in enumerate(spaces)
        }
        self.session_id = -1

        self._get_observation = get_observation
Esempio n. 2
0
    def __init__(
        self,
        raw_step: Callable[
            [List[ActionType], List[ObservationType], List[RewardType]],
            StepType],
        spaces: List[ObservationSpace],
    ):
        if not spaces:
            raise ValueError("No observation spaces")
        self.spaces: Dict[str, ObservationSpaceSpec] = {}

        self._raw_step = raw_step

        for i, s in enumerate(spaces):
            self._add_space(ObservationSpaceSpec.from_proto(i, s))