Fix the vector wrapper warnings (#1415)

This commit is contained in:
Mark Towers
2025-07-05 17:47:24 +01:00
committed by GitHub
parent 18da906de7
commit fc07f2c601
3 changed files with 5 additions and 3 deletions

View File

@@ -387,7 +387,7 @@ class ResizeObservation(
) from e
self.shape: Final[tuple[int, int]] = tuple(shape)
# for some reason, cv2.resize will return the shape in reverse, todo confirm implementation
# for some reason, cv2.resize will return the shape in reverse
self.cv2_shape: Final[tuple[int, int]] = (shape[1], shape[0])
new_observation_space = spaces.Box(

View File

@@ -85,7 +85,9 @@ class RecordEpisodeStatistics(VectorWrapper):
super().__init__(env)
self._stats_key = stats_key
if "autoreset_mode" not in self.env.metadata:
warn("todo")
warn(
f"{self} is missing `autoreset_mode` tag in its metadata, therefore, `RecordEpisodeStatistics` is assuming that the environment uses `AutoresetMode.NEXT_STEP`. See `https://farama.org/Vector-Autoreset-Mode` for more information on autoreset modes."
)
self._autoreset_mode = AutoresetMode.NEXT_STEP
else:
assert isinstance(self.env.metadata["autoreset_mode"], AutoresetMode)

View File

@@ -74,7 +74,7 @@ class NormalizeObservation(VectorObservationWrapper, gym.utils.RecordConstructor
if "autoreset_mode" not in self.env.metadata:
warn(
f"{self} is missing `autoreset_mode` data. Assuming that the vector environment it follows the `NextStep` autoreset api or autoreset is disabled. Read todo for more details."
f"{self} is missing `autoreset_mode` data. Assuming that the vector environment it follows the `NextStep` autoreset api or autoreset is disabled. Read https://farama.org/Vector-Autoreset-Mode for more details."
)
else:
assert self.env.metadata["autoreset_mode"] in {AutoresetMode.NEXT_STEP}