Skip to content

Commit 1f0b769

Browse files
authored
[Doc] Tutorial: recurrent training on sequence batches (#3860)
1 parent 7846b4a commit 1f0b769

4 files changed

Lines changed: 503 additions & 0 deletions

File tree

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Intermediate
116116
tutorials/torchrl_envs
117117
tutorials/pretrained_models
118118
tutorials/dqn_with_rnn
119+
tutorials/recurrent_sequence_training
119120
tutorials/mujoco_cube_bowl_macros
120121
tutorials/collector_trajectory_assembly
121122
tutorials/evaluator

docs/source/reference/data_layout.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ Pair with :class:`~torchrl.cuda_memory_profile` to verify the win:
453453
See also
454454
--------
455455

456+
* :ref:`Recurrent training on sequence batches <recurrent_sequence_tuto>` —
457+
a runnable tutorial that samples ragged trajectory slices with
458+
:class:`~torchrl.data.replay_buffers.SliceSampler` and feeds them straight
459+
into a recurrent policy, the contiguous-batch pattern described on this
460+
page.
456461
* :doc:`collectors_replay` — concrete ``ndim`` patterns and the full
457462
``trajs_per_batch`` API.
458463
* :ref:`Auto-wrapping recurrent transforms <Environment-policy-arg>` —

docs/source/reference/recurrent_state_lifecycle.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,14 @@ What to check, in order
359359
See also
360360
--------
361361

362+
- :ref:`Recurrent training on sequence batches <recurrent_sequence_tuto>` —
363+
a runnable tutorial that walks through this lifecycle end to end:
364+
collection, :class:`~torchrl.data.replay_buffers.SliceSampler` replay, and
365+
a full-sequence ``set_recurrent_mode(True)`` forward.
366+
- ``examples/replay-buffers/recurrent_slice_sampler_pipeline.py`` — a
367+
minimal, runnable script version (GRU policy, the collector writing
368+
directly into the buffer, ``SliceSampler`` auto-detecting the trajectory
369+
key).
362370
- :class:`~torchrl.modules.LSTMModule` — the module that consumes
363371
``is_init`` and gates hidden-state resets.
364372
- :class:`~torchrl.modules.GRUModule` — same lifecycle, single hidden

0 commit comments

Comments
 (0)