BroadcastingContainer¶
- class maze.train.parallelization.broadcasting_container.BroadcastingContainer¶
Synchronizes policy updates and other information across workers on local machine.
Used for dummy and sub-process distribution scenarios.
The BroadcastingContainer object can be read by all workers in order to update their policy, and it can be accessed by the main thread to write the updated policy from the learner into it.
- get_current_policy(last_version: int) -> (<class 'int'>, typing.Dict, typing.Dict)¶
Check if new policy version is available, and if so, return the state_dict and aux_data.
- Parameters:
last_version – Last version known to the worker/agent.
- Returns:
A tuple of (current_version_id, state_dict, aux_data). If the current version matches the last_version supplied as the argument, the state_dict and aux_data will be nil, to avoid transferring unnecessary data with each policy version check.
- policy_version() int¶
Return the current policy version number (to check whether fetching a new state dict is necessary).