subproc#
Source code: tianshou/env/worker/subproc.py
- class SubprocEnvWorker(env_fn: Callable[[], Env], share_memory: bool = False)[source]#
Subprocess worker used in SubprocVectorEnv and ShmemVectorEnv.
- recv() tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray] | tuple[numpy.ndarray, dict][source]#
Receive result from low-level worker.
If the last “send” function sends a NULL action, it only returns a single observation; otherwise it returns a tuple of (obs, rew, done, info) or (obs, rew, terminated, truncated, info), based on whether the environment is using the old step API or the new one.
- send(action: numpy.ndarray | None, **kwargs: Any) None[source]#
Send action signal to low-level worker.
When action is None, it indicates sending “reset” signal; otherwise it indicates “step” signal. The paired return value from “recv” function is determined by such kind of different signal.
- static wait(workers: list[SubprocEnvWorker], wait_num: int, timeout: float | None = None) list[SubprocEnvWorker][source]#
Given a list of workers, return those ready ones.