Rate this Page
★ ★ ★ ★ ★

Tutorials#

Each tutorial solves one task with a script that runs from top to bottom on a CPU. The documentation build runs every script, so the output on each page comes from the code above it. Each page has links to download the script and a Jupyter notebook, and ends with a “Further reading” list of the guides and API pages that go deeper. If you are new to tensordict, read Getting started first.

The sidebar lists the tutorials in four groups, in reading order:

  • Basics: keys, indexing, shapes, row-by-row filling, and lazy stacks of streamed data.

  • Storage: devices and memory-mapped tensors, the zarr backend, and a benchmark of the serialization formats.

  • tensordict.nn: modules that read and write tensordicts, functional calls and ensembles, and export with torch.export.

  • Data loading: datasets in a TensorDict or a TensorClass, and batched loading of an image dataset.

Getting, setting, and nesting keys

Getting, setting, and nesting keys

Slicing, indexing, and masking

Slicing, indexing, and masking

Changing the shape of a TensorDict

Changing the shape of a TensorDict

Filling a TensorDict row by row

Filling a TensorDict row by row

Building tensordicts from streams

Building tensordicts from streams

Devices and memory-mapped tensors

Devices and memory-mapped tensors

Storing TensorDicts in zarr

Storing TensorDicts in zarr

Benchmarking TensorDict serialization speed

Benchmarking TensorDict serialization speed

Building models with TensorDictModule

Building models with TensorDictModule

Functional calls and ensembles with TensorDict

Functional calls and ensembles with TensorDict

Exporting tensordict modules

Exporting tensordict modules

Using TensorDict for datasets

Using TensorDict for datasets

Using tensorclasses for datasets

Using tensorclasses for datasets

Batched data loading with tensorclasses

Batched data loading with tensorclasses

Simulating particles with a tensorclass

Simulating particles with a tensorclass

Gallery generated by Sphinx-Gallery