Shortcuts

sync_sync_collector

torchrl.trainers.helpers.sync_sync_collector(env_fns: Union[Callable, List[Callable]], env_kwargs: Optional[Union[dict, List[dict]]], num_env_per_collector: Optional[int] = None, num_collectors: Optional[int] = None, **kwargs) Union[SyncDataCollector, MultiSyncDataCollector][source]

Runs synchronous collectors, each running synchronous environments.

E.g.

../../_images/aafig-77eaa37526b10b56438e35ff9489eb12c19b4c6c.svg

Envs can be identical or different. In the latter case, env_fns should be a list with all the creator fns for the various envs, and the policy should handle those envs in batch.

Parameters:
  • env_fns – Callable (or list of Callables) returning an instance of EnvBase class.

  • env_kwargs – Optional. Dictionary (or list of dictionaries) containing the kwargs for the environment being created.

  • num_env_per_collector – Number of environments per data collector. The product num_env_per_collector * num_collectors should be less or equal to the number of workers available.

  • num_collectors – Number of data collectors to be run in parallel.

  • **kwargs – Other kwargs passed to the data collectors

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources