Shortcuts

register_gym_spec_conversion

torchrl.envs.register_gym_spec_conversion(spec_type)[source]

Decorator to register a conversion function for a specific spec type.

The method must have the following signature:

>>> @register_gym_spec_conversion("spec.name")
... def convert_specname(
...     spec,
...     dtype=None,
...     device=None,
...     categorical_action_encoding=None,
...     remap_state_to_observation=None,
...     batch_size=None,
... ):

where gym(nasium).spaces.spec.name is the location of the spec in gym.

If the spec type is accessible, this will also work:

>>> @register_gym_spec_conversion(SpecType)
... def convert_specname(
...     spec,
...     dtype=None,
...     device=None,
...     categorical_action_encoding=None,
...     remap_state_to_observation=None,
...     batch_size=None,
... ):

..note:: The wrapped function can be simplified, and unused kwargs can be wrapped in **kwargs.

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