skillfed

tensordict-nightly

TensorDict is a pytorch dedicated tensor container.

tensordict-nightly v2026.8.14 188.5K downloads/30d#9,942 on PyPI1,034
Permissive license BSD Active released

What it is and what it does

TensorDict is a container that wraps multiple PyTorch tensors into a single batched, nested structure while preserving tensor semantics. Instead of manually managing a collection of tensors with aligned batch dimensions, you create a TensorDict once and then slice, reshape, move to device, or perform arithmetic on the entire structure as if it were a single tensor. Every operation applies uniformly to all leaf tensors, keeping the batch dimension honest.

It is designed for data-heavy PyTorch workflows—training loops, reinforcement learning rollouts, parameter ensembles, and offline datasets—where the natural unit of data is not one tensor but a structured collection. The package includes memory-mapped I/O, lazy stacking, functional parameter handling, and torch.compile support to reduce boilerplate and improve performance in large systems.

Use it for:

  • Training loops where a single batch object flows through dataset, model, and loss without unpacking and repacking tensors.
  • Reinforcement learning environments that need to track nested state (agent policy, value, environment reward, done flags) with synchronized batch operations.
  • Offline datasets and replay buffers that benefit from memory-mapped storage and efficient slicing across many tensor leaves.
  • Functional training with parameter ensembles, where module weights are held in a TensorDict and swapped in and out of modules.
  • Multi-agent or hierarchical systems with nested data structures (e.g., agents.policy, env.reward) that need uniform batch semantics.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

TensorDict is a batched, nested dictionary container for PyTorch tensors that behaves like a single tensor—enabling slicing, reshaping, device transfer, and arithmetic operations across all leaves simultaneously while maintaining a shared batch size.

Yes. TensorDict is actively maintained, has no known vulnerabilities, and is widely used in PyTorch RL and training systems. Install the nightly release if you are comfortable with frequent updates; otherwise, wait for a stable release. It is worth installing if you work with structured tensor batches and want to eliminate manual dimension tracking and repetitive tensor operations.

Install

tensordict-nightly on PyPI

pip

pip install tensordict-nightly

uv

uv add tensordict-nightly

poetry

poetry add tensordict-nightly

Installing tensordict-nightly

Before you install

Nightly release with active maintenance (last commit 2026-08-14) and broad platform coverage across Python 3.10–3.14 on macOS, Linux, and Windows. Medium install friction due to compiled wheels; no known vulnerabilities.

License in practice

BSD permissive license allows commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install tensordict-nightly

import torch
from tensordict import TensorDict

batch = TensorDict(
    {"obs": torch.randn(32, 128), "action": torch.randint(0, 4, (32,))},
    batch_size=[32],
)
mini = batch[:8]  # slices all leaves
on_device = batch.to("cuda")  # moves all leaves

Requires PyTorch (torch) and modern Python (3.10+); compiled wheels available for common platforms.

Verify before relying

  • Whether nightly releases receive the same stability guarantees as stable releases
  • Performance overhead of TensorDict operations compared to manual tensor handling in specific workloads

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 7 — torch, numpy, cloudpickle, packaging, importlib_metadata, orjson, pyvers
Maintenance actively maintained — 0 days since the last release
Last repo commit
First released
Downloads 188,521/month — #9,942 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tensordict_nightly-2026.8.14-cp310-cp310-macosx_11_0_universal2.whl; tensordict_nightly-2026.8.14-cp310-cp310-manylinux1_x86_64.whl; tensordict_nightly-2026.8.14-cp310-cp310-manylinux_2_28_aarch64.whl; tensordict_nightly-2026.8.14-cp310-cp310-win_amd64.whl; tensordict_nightly-2026.8.14-cp311-cp311-macosx_11_0_universal2.whl; tensordict_nightly-2026.8.14-cp311-cp311-manylinux1_x86_64.whl; tensordict_nightly-2026.8.14-cp311-cp311-manylinux_2_28_aarch64.whl; tensordict_nightly-2026.8.14-cp311-cp311-win_amd64.whl; tensordict_nightly-2026.8.14-cp312-cp312-macosx_11_0_universal2.whl; tensordict_nightly-2026.8.14-cp312-cp312-manylinux1_x86_64.whl; tensordict_nightly-2026.8.14-cp312-cp312-manylinux_2_28_aarch64.whl; tensordict_nightly-2026.8.14-cp312-cp312-win_amd64.whl; tensordict_nightly-2026.8.14-cp313-cp313-macosx_11_0_universal2.whl; tensordict_nightly-2026.8.14-cp313-cp313-manylinux1_x86_64.whl; tensordict_nightly-2026.8.14-cp313-cp313-manylinux_2_28_aarch64.whl; tensordict_nightly-2026.8.14-cp313-cp313-win_amd64.whl; tensordict_nightly-2026.8.14-cp314-cp314-macosx_11_0_universal2.whl; tensordict_nightly-2026.8.14-cp314-cp314-manylinux1_x86_64.whl; tensordict_nightly-2026.8.14-cp314-cp314-manylinux_2_28_aarch64.whl; tensordict_nightly-2026.8.14-cp314-cp314t-manylinux_2_28_aarch64.whl

Development Status :: 4 - BetaProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

batched tensor dictionarynested tensor container pytorchtensor batch operationsstructured tensor datapytorch tensor dictbatch-aware tensor structuretensor collection management
pytorch-ecosystemtensor-containersbatch-operations

More Artificial Intelligence packages