tensordict-nightly
TensorDict is a pytorch dedicated tensor container.
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-nightlyuv
uv add tensordict-nightlypoetry
poetry add tensordict-nightlyInstalling 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
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
tensordictTensorDict is a batched, nested dictionary…
permissive · top 5,000 on PyPI
docarrayDocArray provides a Python data structure for…
permissive · top 15,000 on PyPI
torchrlTorchRL is a PyTorch-native toolkit for…
unclear · top 5,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
tensorlyTensorLy performs tensor decomposition, tensor…
permissive · top 15,000 on PyPI
rotary-embedding-torchImplements rotary positional embeddings for…
permissive · top 15,000 on PyPI
einopsEinops provides readable tensor operations…
permissive · top 1,000 on PyPI
linear-operatorLinearOperator abstracts structured matrix…
permissive · top 5,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
pytorch-forecastingPyTorch Forecasting provides neural network…
permissive · top 15,000 on PyPI