# pytorch/tensordict

TensorDict is a pytorch dedicated tensor container.

Repository: https://github.com/pytorch/tensordict
Canonical: https://ross.abutalabs.com/products/tensordict
Language: Python
License: MIT
License Family: permissive
Last push: 2026-09-02T18:22:24+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 98, longevity 100
- inputs: {"age_days": 1414, "days_push": 0, "days_rel": 19, "gap_med": 12.5, "n_releases_24m": 21}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1036, forks 117 (observed 2026-09-03T02:15:17.158524+00:00)

## What it is
TensorDict is a PyTorch library providing a batched, nested dict-like tensor container where operations like slicing, stacking, and arithmetic propagate to every tensor leaf. It keeps a shared batch_size across nested structures, making it easy to handle heterogeneous tensor data such as RL rollouts or model batches.

## Use cases
- manage batches of heterogeneous tensors in pytorch
- store reinforcement learning rollouts with nested observations
- slice and move nested tensor structures to gpu in one call
- stack and reshape batches of tensor dictionaries
- serialize and save collections of tensors with a shared batch size

## When to choose
- you work in PyTorch with nested or heterogeneous tensor data like RL transitions
- you want dictionary flexibility with tensor-like batch operations
- you need consistent batch_size enforcement across nested structures

## When to avoid
- your project does not use PyTorch
- you only need plain tensors or simple homogeneous batches
- you need a framework-agnostic container

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, data-science, serialization
- domain: machine-learning, deep-learning, data-science, reinforcement-learning
- platform: python, cross-platform
- tags: pytorch, tensor-container, batched-dictionary, rl

## Member repositories
- pytorch/tensordict (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-09-03T02:15:17.158524+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:05:10.025821+00:00, confidence not recorded.
  - readme: https://github.com/pytorch/tensordict (fetched 2026-09-03T02:15:17.158524+00:00, sha af56b5eb5251)
- Data as of 2026-08-30T08:39:29.467469+00:00.
