ray.rllib.evaluation.worker_set.WorkerSet.foreach_env_with_context#

WorkerSet.foreach_env_with_context(func: Callable[[BaseEnv, EnvContext], List[T]]) List[List[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.