ray.rllib.evaluation.worker_set.WorkerSet.foreach_env_with_context
ray.rllib.evaluation.worker_set.WorkerSet.foreach_env_with_context#
- WorkerSet.foreach_env_with_context(func: Callable[[ray.rllib.env.base_env.BaseEnv, ray.rllib.env.env_context.EnvContext], List[ray.rllib.evaluation.worker_set.T]]) List[List[ray.rllib.evaluation.worker_set.T]] [source]#
Calls
func
with all workers’ sub-environments and env_ctx as args.An “underlying sub environment” is a single clone of an env within a vectorized environment.
func
takes a single underlying sub environment and the env_context as args.- Parameters
func – A function - taking a BaseEnv object and an EnvContext as arg - and returning a list of lists of return values over envs of the worker.
- Returns
- The list (1 item per workers) of lists (1 item per sub-environment)
of results.