RolloutWorker.foreach_policy_to_train(func: Callable[[Policy, str, Any | None], T], **kwargs) List[T][source]#

Calls the given function with each (policy, policy_id) tuple.

Only those policies/IDs will be called on, for which self.is_policy_to_train() returns True.


func – The function to call with each (policy, policy ID) tuple, for only those policies that self.is_policy_to_train returns True.

Keyword Arguments:

kwargs – Additional kwargs to be passed to the call.


The list of return values of all calls to func([policy, pid, **kwargs]).