Shortcuts

set_recurrent_mode

class torchrl.modules.set_recurrent_mode(mode: Optional[Union[bool, Literal['recurrent', 'sequential']]] = True)[source]

Context manager for setting RNNs recurrent mode.

Parameters:

mode (bool, "recurrent" or "stateful") – the recurrent mode to be used within the context manager. “recurrent” leads to mode=True and “stateful” leads to mode=False. An RNN executed with recurrent_mode “on” assumes that the data comes in time batches, otherwise it is assumed that each data element in a tensordict is independent of the others. The default value of this context manager is True. The default recurrent mode is None, i.e., the default recurrent mode of the RNN is used (see LSTMModule and GRUModule constructors).

See also

recurrent_mode`.

Note

All of TorchRL methods are decorated with set_recurrent_mode(True) by default.

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