* Changes to support Gym 0.26.0 * Replace map by simpler list comprehension * Use syntax that is compatible with python 3.7 * Format code * Fix environment seeding in test environment, fix buffer_profile test * Remove self.seed() from __init__ * Fix random number generation * Fix throughput tests * Fix tests * Removed done field from Buffer, fixed throughput test, turned off wandb, fixed formatting, fixed type hints, allow preprocessing_fn with truncated and terminated arguments, updated docstrings * fix lint * fix * fix import * fix * fix mypy * pytest --ignore='test/3rd_party' * Use correct step API in _SetAttrWrapper * Format * Fix mypy * Format * Fix pydocstyle.
22 lines
606 B
Python
22 lines
606 B
Python
from typing import Any, Tuple
|
|
|
|
import cloudpickle
|
|
import numpy as np
|
|
|
|
gym_old_venv_step_type = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
|
|
gym_new_venv_step_type = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray,
|
|
np.ndarray]
|
|
|
|
|
|
class CloudpickleWrapper(object):
|
|
"""A cloudpickle wrapper used in SubprocVectorEnv."""
|
|
|
|
def __init__(self, data: Any) -> None:
|
|
self.data = data
|
|
|
|
def __getstate__(self) -> str:
|
|
return cloudpickle.dumps(self.data)
|
|
|
|
def __setstate__(self, data: str) -> None:
|
|
self.data = cloudpickle.loads(data)
|