tensordict-nightly


Nametensordict-nightly JSON
Version 2024.4.18 PyPI version JSON
download
home_pagehttps://github.com/pytorch/tensordict
SummaryNone
upload_time2024-04-18 13:53:27
maintainerNone
docs_urlNone
authortensordict contributors
requires_pythonNone
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--- BADGES: START --->
<!---
[![Documentation](https://img.shields.io/badge/Documentation-blue.svg?style=flat)](https://pytorch.github.io/tensordict/)
--->
[![Docs - GitHub.io](https://img.shields.io/static/v1?logo=github&style=flat&color=pink&label=docs&message=tensordict)][#docs-package]
[![Benchmarks](https://img.shields.io/badge/Benchmarks-blue.svg)][#docs-package-benchmark]
[![Python version](https://img.shields.io/pypi/pyversions/tensordict.svg)](https://www.python.org/downloads/)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)][#github-license]
<a href="https://pypi.org/project/tensordict"><img src="https://img.shields.io/pypi/v/tensordict" alt="pypi version"></a>
<a href="https://pypi.org/project/tensordict-nightly"><img src="https://img.shields.io/pypi/v/tensordict-nightly?label=nightly" alt="pypi nightly version"></a>
[![Downloads](https://static.pepy.tech/personalized-badge/tensordict?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads)][#pepy-package]
[![Downloads](https://static.pepy.tech/personalized-badge/tensordict-nightly?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads%20(nightly))][#pepy-package-nightly]
[![codecov](https://codecov.io/gh/pytorch/tensordict/branch/main/graph/badge.svg?token=9QTUG6NAGQ)][#codecov-package]
[![circleci](https://circleci.com/gh/pytorch/tensordict.svg?style=shield)][#circleci-package]
[![Conda - Platform](https://img.shields.io/conda/pn/conda-forge/tensordict?logo=anaconda&style=flat)][#conda-forge-package]
[![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/tensordict?logo=anaconda&style=flat&color=orange)][#conda-forge-package]

[#docs-package]: https://pytorch.github.io/tensordict/
[#docs-package-benchmark]: https://pytorch.github.io/tensordict/dev/bench/
[#github-license]: https://github.com/pytorch/tensordict/blob/main/LICENSE
[#pepy-package]: https://pepy.tech/project/tensordict
[#pepy-package-nightly]: https://pepy.tech/project/tensordict-nightly
[#codecov-package]: https://codecov.io/gh/pytorch/tensordict
[#circleci-package]: https://circleci.com/gh/pytorch/tensordict
[#conda-forge-package]: https://anaconda.org/conda-forge/tensordict

<!--- BADGES: END --->

# TensorDict

[**Installation**](#installation) | [**General features**](#general-principles) |
[**Tensor-like features**](#tensor-like-features) |  [**Distributed capabilities**](#distributed-capabilities) |
[**TensorDict for functional programming**](#tensordict-for-functional-programming) |
[**TensorDict for parameter serialization](#tensordict-for-parameter-serialization) |
[**Lazy preallocation**](#lazy-preallocation) | [**Nesting TensorDicts**](#nesting-tensordicts) | [**TensorClass**](#tensorclass)

`TensorDict` is a dictionary-like class that inherits properties from tensors,
such as indexing, shape operations, casting to device or point-to-point communication
in distributed settings. Whenever you need to execute an operation over a batch of tensors, 
TensorDict is there to help you.

The primary goal of TensorDict is to make your code-bases more _readable_, _compact_, and _modular_. 
It abstracts away tailored operations, making your code less error-prone as it takes care of 
dispatching the operation on the leaves for you.

Using tensordict primitives, most supervised training loops can be rewritten in a generic way:
```python
for i, data in enumerate(dataset):
    # the model reads and writes tensordicts
    data = model(data)
    loss = loss_module(data)
    loss.backward()
    optimizer.step()
    optimizer.zero_grad()
```

With this level of abstraction, one can recycle a training loop for highly heterogeneous task.
Each individual step of the training loop (data collection and transform, model prediction, loss computation etc.)
can be tailored to the use case at hand without impacting the others.
For instance, the above example can be easily used across classification and segmentation tasks, among many others.

## Features

### General principles

Unlike other [pytrees](https://github.com/pytorch/pytorch/blob/main/torch/utils/_pytree.py), TensorDict
carries metadata that make it easy to query the state of the container. The main metadata
are the [``batch_size``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.batch_size) 
(also referred as ``shape``), 
the [``device``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.device), 
the shared status
([``is_memmap``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDictBase.html#tensordict.TensorDictBase.is_memmap) or 
[``is_shared``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDictBase.html#tensordict.TensorDictBase.is_shared)), 
the dimension [``names``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.names) 
and the [``lock``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.lock_) status.

A tensordict is primarily defined by its `batch_size` (or `shape`) and its key-value pairs:
```python
>>> from tensordict import TensorDict
>>> import torch
>>> data = TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": torch.zeros(3, 4, 5, dtype=torch.bool),
... }, batch_size=[3, 4])
```
The `batch_size` and the first dimensions of each of the tensors must be compliant.
The tensors can be of any dtype and device. 

Optionally, one can restrict a tensordict to
live on a dedicated ``device``, which will send each tensor that is written there:
```python
>>> data = TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": torch.zeros(3, 4, 5, dtype=torch.bool),
... }, batch_size=[3, 4], device="cuda:0")
```
When a tensordict has a device, all write operations will cast the tensor to the
TensorDict device:
```python
>>> data["key 3"] = torch.randn(3, 4, device="cpu")
>>> assert data["key 3"].device is torch.device("cuda:0")
```
Once the device is set, it can be cleared with the 
[``clear_device_``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.clear_device_)
method. 

### TensorDict as a specialized dictionary
TensorDict possesses all the basic features of a dictionary such as 
[``clear``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.clear), 
[``copy``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.copy), 
[``fromkeys``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.fromkeys), 
[``get``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.get), 
[``items``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.items), 
[``keys``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.keys), 
[``pop``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.pop), 
[``popitem``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.popitem), 
[``setdefault``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.setdefault), 
[``update``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.update) and 
[``values``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.values).

But that is not all, you can also store nested values in a tensordict:
```python
>>> data["nested", "key"] = torch.zeros(3, 4) # the batch-size must match
```
and any nested tuple structure will be unravelled to make it easy to read code and
write ops programmatically:
```python
>>> data["nested", ("supernested", ("key",))] = torch.zeros(3, 4) # the batch-size must match
>>> assert (data["nested", "supernested", "key"] == 0).all()
>>> assert (("nested",), "supernested", (("key",),)) in data.keys(include_nested=True)  # this works too!
```

You can also store non-tensor data in tensordicts:

```python
>>> data = TensorDict({"a-tensor": torch.randn(1, 2)}, batch_size=[1, 2])
>>> data["non-tensor"] = "a string!"
>>> assert data["non-tensor"] == "a string!"
```

### Tensor-like features

**\[Nightly feature\]** TensorDict supports many common point-wise arithmetic operations such as `==` or `+`, `+=`
and similar (provided that the underlying tensors support the said operation):
```python
>>> td = TensorDict.fromkeys(["a", "b", "c"], 0)
>>> td += 1
>>> assert (td==1).all()
```

TensorDict objects can be indexed exactly like tensors. The resulting of indexing
a TensorDict is another TensorDict containing tensors indexed along the required dimension:
```python
>>> data = TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": torch.zeros(3, 4, 5, dtype=torch.bool),
... }, batch_size=[3, 4])
>>> sub_tensordict = data[..., :2]
>>> assert sub_tensordict.shape == torch.Size([3, 2])
>>> assert sub_tensordict["key 1"].shape == torch.Size([3, 2, 5])
```

Similarly, one can build tensordicts by stacking or concatenating single tensordicts:
```python
>>> tensordicts = [TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": torch.zeros(3, 4, 5, dtype=torch.bool),
... }, batch_size=[3, 4]) for _ in range(2)]
>>> stack_tensordict = torch.stack(tensordicts, 1)
>>> assert stack_tensordict.shape == torch.Size([3, 2, 4])
>>> assert stack_tensordict["key 1"].shape == torch.Size([3, 2, 4, 5])
>>> cat_tensordict = torch.cat(tensordicts, 0)
>>> assert cat_tensordict.shape == torch.Size([6, 4])
>>> assert cat_tensordict["key 1"].shape == torch.Size([6, 4, 5])
```

TensorDict instances can also be reshaped, viewed, squeezed and unsqueezed:
```python
>>> data = TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": torch.zeros(3, 4, 5, dtype=torch.bool),
... }, batch_size=[3, 4])
>>> print(data.view(-1))
torch.Size([12])
>>> print(data.reshape(-1))
torch.Size([12])
>>> print(data.unsqueeze(-1))
torch.Size([3, 4, 1])
```

One can also send tensordict from device to device, place them in shared memory,
clone them, update them in-place or not, split them, unbind them, expand them etc.

If a functionality is missing, it is easy to call it using `apply()` or `apply_()`:
```python
tensordict_uniform = data.apply(lambda tensor: tensor.uniform_())
```

``apply()`` can also be great to filter a tensordict, for instance:
```python
data = TensorDict({"a": torch.tensor(1.0, dtype=torch.float), "b": torch.tensor(1, dtype=torch.int64)}, [])
data_float = data.apply(lambda x: x if x.dtype == torch.float else None) # contains only the "a" key
assert "b" not in data_float
```

### Distributed capabilities

Complex data structures can be cumbersome to synchronize in distributed settings.
`tensordict` solves that problem with synchronous and asynchronous helper methods
such as `recv`, `irecv`, `send` and `isend` that behave like their `torch.distributed`
counterparts:
```python
>>> # on all workers
>>> data = TensorDict({"a": torch.zeros(()), ("b", "c"): torch.ones(())}, [])
>>> # on worker 1
>>> data.isend(dst=0)
>>> # on worker 0
>>> data.irecv(src=1)
```

When nodes share a common scratch space, the
[`MemmapTensor` backend](https://pytorch.github.io/tensordict/tutorials/tensordict_memory.html)
can be used
to seamlessly send, receive and read a huge amount of data.

### TensorDict for functional programming

We also provide an API to use TensorDict in conjunction with [FuncTorch](https://pytorch.org/functorch).
For instance, TensorDict makes it easy to concatenate model weights to do model ensembling:
```python
>>> from torch import nn
>>> from tensordict import TensorDict
>>> import torch
>>> from torch import vmap
>>> layer1 = nn.Linear(3, 4)
>>> layer2 = nn.Linear(4, 4)
>>> model = nn.Sequential(layer1, layer2)
>>> params = TensorDict.from_module(model)
>>> # we represent the weights hierarchically
>>> weights1 = TensorDict(layer1.state_dict(), []).unflatten_keys(".")
>>> weights2 = TensorDict(layer2.state_dict(), []).unflatten_keys(".")
>>> assert (params == TensorDict({"0": weights1, "1": weights2}, [])).all()
>>> # Let's use our functional module
>>> x = torch.randn(10, 3)
>>> with params.to_module(model):
...     out = model(x)
>>> # an ensemble of models: we stack params along the first dimension...
>>> params_stack = torch.stack([params, params], 0)
>>> # ... and use it as an input we'd like to pass through the model
>>> def func(x, params):
...     with params.to_module(model):
...         return model(x)
>>> y = vmap(func, (None, 0))(x, params_stack)
>>> print(y.shape)
torch.Size([2, 10, 4])
```

Moreover, tensordict modules are compatible with `torch.fx` and (soon) `torch.compile`,
which means that you can get the best of both worlds: a codebase that is
both readable and future-proof as well as efficient and portable!

### TensorDict for parameter serialization and building datasets

TensorDict offers an API for parameter serialization that can be >3x faster than
regular calls to `torch.save(state_dict)`. Moreover, because tensors will be saved
independently on disk, you can deserialize your checkpoint on an arbitrary slice
of the model.

```python
>>> model = nn.Sequential(nn.Linear(3, 4), nn.Linear(4, 3))
>>> params = TensorDict.from_module(model)
>>> params.memmap("/path/to/saved/folder/", num_threads=16)  # adjust num_threads for speed
>>> # load params
>>> params = TensorDict.load_memmap("/path/to/saved/folder/", num_threads=16)
>>> params.to_module(model)  # load onto model
>>> params["0"].to_module(model[0])  # load on a slice of the model
>>> # in the latter case we could also have loaded only the slice we needed
>>> params0 = TensorDict.load_memmap("/path/to/saved/folder/0", num_threads=16)
>>> params0.to_module(model[0])  # load on a slice of the model
```

The same functionality can be used to access data in a dataset stored on disk.
Soring a single contiguous tensor on disk accessed through the `tensordict.MemoryMappedTensor`
primitive and reading slices of it is not only **much** faster than loading
single files one at a time but it's also easier and safer (because there is no pickling
or third-party library involved):

```python
# allocate memory of the dataset on disk
data = TensorDict({
    "images": torch.zeros((128, 128, 3), dtype=torch.uint8),
    "labels": torch.zeros((), dtype=torch.int)}, batch_size=[])
data = data.expand(1000000)
data = data.memmap_like("/path/to/dataset")
# ==> Fill your dataset here
# Let's get 3 items of our dataset:
data[torch.tensor([1, 10000, 500000])]  # This is much faster than loading the 3 images independently
```

### Preprocessing with TensorDict.map

Preprocessing huge contiguous (or not!) datasets can be done via `TensorDict.map`
which will dispatch a task to various workers:

```python
import torch
from tensordict import TensorDict, MemoryMappedTensor
import tempfile

def process_data(data):
    images = data.get("images").flip(-2).clone()
    labels = data.get("labels") // 10
    # we update the td inplace
    data.set_("images", images)  # flip image
    data.set_("labels", labels)  # cluster labels

if __name__ == "__main__":
    # create data_preproc here
    data_preproc = data.map(process_data, num_workers=4, chunksize=0, pbar=True)  # process 1 images at a time
```

### Lazy preallocation

Pre-allocating tensors can be cumbersome and hard to scale if the list of preallocated
items varies according to the script configuration. TensorDict solves this in an elegant way.
Assume you are working with a function `foo() -> TensorDict`, e.g.
```python
def foo():
    data = TensorDict({}, batch_size=[])
    data["a"] = torch.randn(3)
    data["b"] = TensorDict({"c": torch.zeros(2)}, batch_size=[])
    return data
```
and you would like to call this function repeatedly. You could do this in two ways.
The first would simply be to stack the calls to the function:
```python
data = torch.stack([foo() for _ in range(N)])
```
However, you could also choose to preallocate the tensordict:
```python
data = TensorDict({}, batch_size=[N])
for i in range(N):
    data[i] = foo()
```
which also results in a tensordict (when `N = 10`)
```
TensorDict(
    fields={
        a: Tensor(torch.Size([10, 3]), dtype=torch.float32),
        b: TensorDict(
            fields={
                c: Tensor(torch.Size([10, 2]), dtype=torch.float32)},
            batch_size=torch.Size([10]),
            device=None,
            is_shared=False)},
    batch_size=torch.Size([10]),
    device=None,
    is_shared=False)
```
When `i==0`, your empty tensordict will automatically be populated with empty tensors
of batch-size `N`. After that, updates will be written in-place.
Note that this would also work with a shuffled series of indices (pre-allocation does
not require you to go through the tensordict in an ordered fashion).


### Nesting TensorDicts

It is possible to nest tensordict. The only requirement is that the sub-tensordict should be indexable
under the parent tensordict, i.e. its batch size should match (but could be longer than) the parent
batch size.

We can switch easily between hierarchical and flat representations.
For instance, the following code will result in a single-level tensordict with keys `"key 1"` and `"key 2.sub-key"`:
```python
>>> data = TensorDict({
...     "key 1": torch.ones(3, 4, 5),
...     "key 2": TensorDict({"sub-key": torch.randn(3, 4, 5, 6)}, batch_size=[3, 4, 5])
... }, batch_size=[3, 4])
>>> tensordict_flatten = data.flatten_keys(separator=".")
```

Accessing nested tensordicts can be achieved with a single index:
```python
>>> sub_value = data["key 2", "sub-key"]
```

## TensorClass

Content flexibility comes at the cost of predictability.
In some cases, developers may be looking for data structure with a more explicit behavior.
`tensordict` provides a `dataclass`-like decorator that allows for the creation of custom dataclasses that support
the tensordict operations:
```python
>>> from tensordict.prototype import tensorclass
>>> import torch
>>>
>>> @tensorclass
... class MyData:
...    image: torch.Tensor
...    mask: torch.Tensor
...    label: torch.Tensor
...
...    def mask_image(self):
...        return self.image[self.mask.expand_as(self.image)].view(*self.batch_size, -1)
...
...    def select_label(self, label):
...        return self[self.label == label]
...
>>> images = torch.randn(100, 3, 64, 64)
>>> label = torch.randint(10, (100,))
>>> mask = torch.zeros(1, 64, 64, dtype=torch.bool).bernoulli_().expand(100, 1, 64, 64)
>>>
>>> data = MyData(images, mask, label=label, batch_size=[100])
>>>
>>> print(data.select_label(1))
MyData(
    image=Tensor(torch.Size([11, 3, 64, 64]), dtype=torch.float32),
    label=Tensor(torch.Size([11]), dtype=torch.int64),
    mask=Tensor(torch.Size([11, 1, 64, 64]), dtype=torch.bool),
    batch_size=torch.Size([11]),
    device=None,
    is_shared=False)
>>> print(data.mask_image().shape)
torch.Size([100, 6117])
>>> print(data.reshape(10, 10))
MyData(
    image=Tensor(torch.Size([10, 10, 3, 64, 64]), dtype=torch.float32),
    label=Tensor(torch.Size([10, 10]), dtype=torch.int64),
    mask=Tensor(torch.Size([10, 10, 1, 64, 64]), dtype=torch.bool),
    batch_size=torch.Size([10, 10]),
    device=None,
    is_shared=False)
```
As this example shows, one can write a specific data structures with dedicated methods while still enjoying the TensorDict
artifacts such as shape operations (e.g. reshape or permutations), data manipulation (indexing, `cat` and `stack`) or calling
arbitrary functions through the `apply` method (and many more).

Tensorclasses support nesting and, in fact, all the TensorDict features.


## Installation

**With Pip**:

To install the latest stable version of tensordict, simply run

```bash
pip install tensordict
```

This will work with Python 3.7 and upward as well as PyTorch 1.12 and upward.

To enjoy the latest features, one can use

```bash
pip install tensordict-nightly
```

**With Conda**:

Install `tensordict` from `conda-forge` channel.

```sh
conda install -c conda-forge tensordict
```


## Citation

If you're using TensorDict, please refer to this BibTeX entry to cite this work:
```
@misc{bou2023torchrl,
      title={TorchRL: A data-driven decision-making library for PyTorch}, 
      author={Albert Bou and Matteo Bettini and Sebastian Dittert and Vikash Kumar and Shagun Sodhani and Xiaomeng Yang and Gianni De Fabritiis and Vincent Moens},
      year={2023},
      eprint={2306.00577},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}
```

## Disclaimer

TensorDict is at the *beta*-stage, meaning that there may be bc-breaking changes introduced, but 
they should come with a warranty.
Hopefully these should not happen too often, as the current roadmap mostly 
involves adding new features and building compatibility with the broader
PyTorch ecosystem.

## License

TensorDict is licensed under the MIT License. See [LICENSE](LICENSE) for details.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pytorch/tensordict",
    "name": "tensordict-nightly",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "tensordict contributors",
    "author_email": "vmoens@fb.com",
    "download_url": null,
    "platform": null,
    "description": "<!--- BADGES: START --->\n<!---\n[![Documentation](https://img.shields.io/badge/Documentation-blue.svg?style=flat)](https://pytorch.github.io/tensordict/)\n--->\n[![Docs - GitHub.io](https://img.shields.io/static/v1?logo=github&style=flat&color=pink&label=docs&message=tensordict)][#docs-package]\n[![Benchmarks](https://img.shields.io/badge/Benchmarks-blue.svg)][#docs-package-benchmark]\n[![Python version](https://img.shields.io/pypi/pyversions/tensordict.svg)](https://www.python.org/downloads/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)][#github-license]\n<a href=\"https://pypi.org/project/tensordict\"><img src=\"https://img.shields.io/pypi/v/tensordict\" alt=\"pypi version\"></a>\n<a href=\"https://pypi.org/project/tensordict-nightly\"><img src=\"https://img.shields.io/pypi/v/tensordict-nightly?label=nightly\" alt=\"pypi nightly version\"></a>\n[![Downloads](https://static.pepy.tech/personalized-badge/tensordict?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads)][#pepy-package]\n[![Downloads](https://static.pepy.tech/personalized-badge/tensordict-nightly?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads%20(nightly))][#pepy-package-nightly]\n[![codecov](https://codecov.io/gh/pytorch/tensordict/branch/main/graph/badge.svg?token=9QTUG6NAGQ)][#codecov-package]\n[![circleci](https://circleci.com/gh/pytorch/tensordict.svg?style=shield)][#circleci-package]\n[![Conda - Platform](https://img.shields.io/conda/pn/conda-forge/tensordict?logo=anaconda&style=flat)][#conda-forge-package]\n[![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/tensordict?logo=anaconda&style=flat&color=orange)][#conda-forge-package]\n\n[#docs-package]: https://pytorch.github.io/tensordict/\n[#docs-package-benchmark]: https://pytorch.github.io/tensordict/dev/bench/\n[#github-license]: https://github.com/pytorch/tensordict/blob/main/LICENSE\n[#pepy-package]: https://pepy.tech/project/tensordict\n[#pepy-package-nightly]: https://pepy.tech/project/tensordict-nightly\n[#codecov-package]: https://codecov.io/gh/pytorch/tensordict\n[#circleci-package]: https://circleci.com/gh/pytorch/tensordict\n[#conda-forge-package]: https://anaconda.org/conda-forge/tensordict\n\n<!--- BADGES: END --->\n\n# TensorDict\n\n[**Installation**](#installation) | [**General features**](#general-principles) |\n[**Tensor-like features**](#tensor-like-features) |  [**Distributed capabilities**](#distributed-capabilities) |\n[**TensorDict for functional programming**](#tensordict-for-functional-programming) |\n[**TensorDict for parameter serialization](#tensordict-for-parameter-serialization) |\n[**Lazy preallocation**](#lazy-preallocation) | [**Nesting TensorDicts**](#nesting-tensordicts) | [**TensorClass**](#tensorclass)\n\n`TensorDict` is a dictionary-like class that inherits properties from tensors,\nsuch as indexing, shape operations, casting to device or point-to-point communication\nin distributed settings. Whenever you need to execute an operation over a batch of tensors, \nTensorDict is there to help you.\n\nThe primary goal of TensorDict is to make your code-bases more _readable_, _compact_, and _modular_. \nIt abstracts away tailored operations, making your code less error-prone as it takes care of \ndispatching the operation on the leaves for you.\n\nUsing tensordict primitives, most supervised training loops can be rewritten in a generic way:\n```python\nfor i, data in enumerate(dataset):\n    # the model reads and writes tensordicts\n    data = model(data)\n    loss = loss_module(data)\n    loss.backward()\n    optimizer.step()\n    optimizer.zero_grad()\n```\n\nWith this level of abstraction, one can recycle a training loop for highly heterogeneous task.\nEach individual step of the training loop (data collection and transform, model prediction, loss computation etc.)\ncan be tailored to the use case at hand without impacting the others.\nFor instance, the above example can be easily used across classification and segmentation tasks, among many others.\n\n## Features\n\n### General principles\n\nUnlike other [pytrees](https://github.com/pytorch/pytorch/blob/main/torch/utils/_pytree.py), TensorDict\ncarries metadata that make it easy to query the state of the container. The main metadata\nare the [``batch_size``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.batch_size) \n(also referred as ``shape``), \nthe [``device``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.device), \nthe shared status\n([``is_memmap``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDictBase.html#tensordict.TensorDictBase.is_memmap) or \n[``is_shared``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDictBase.html#tensordict.TensorDictBase.is_shared)), \nthe dimension [``names``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.names) \nand the [``lock``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.lock_) status.\n\nA tensordict is primarily defined by its `batch_size` (or `shape`) and its key-value pairs:\n```python\n>>> from tensordict import TensorDict\n>>> import torch\n>>> data = TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": torch.zeros(3, 4, 5, dtype=torch.bool),\n... }, batch_size=[3, 4])\n```\nThe `batch_size` and the first dimensions of each of the tensors must be compliant.\nThe tensors can be of any dtype and device. \n\nOptionally, one can restrict a tensordict to\nlive on a dedicated ``device``, which will send each tensor that is written there:\n```python\n>>> data = TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": torch.zeros(3, 4, 5, dtype=torch.bool),\n... }, batch_size=[3, 4], device=\"cuda:0\")\n```\nWhen a tensordict has a device, all write operations will cast the tensor to the\nTensorDict device:\n```python\n>>> data[\"key 3\"] = torch.randn(3, 4, device=\"cpu\")\n>>> assert data[\"key 3\"].device is torch.device(\"cuda:0\")\n```\nOnce the device is set, it can be cleared with the \n[``clear_device_``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.clear_device_)\nmethod. \n\n### TensorDict as a specialized dictionary\nTensorDict possesses all the basic features of a dictionary such as \n[``clear``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.clear), \n[``copy``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.copy), \n[``fromkeys``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.fromkeys), \n[``get``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.get), \n[``items``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.items), \n[``keys``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.keys), \n[``pop``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.pop), \n[``popitem``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.popitem), \n[``setdefault``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.setdefault), \n[``update``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.update) and \n[``values``](https://pytorch.org/tensordict/reference/generated/tensordict.TensorDict.html#tensordict.TensorDict.values).\n\nBut that is not all, you can also store nested values in a tensordict:\n```python\n>>> data[\"nested\", \"key\"] = torch.zeros(3, 4) # the batch-size must match\n```\nand any nested tuple structure will be unravelled to make it easy to read code and\nwrite ops programmatically:\n```python\n>>> data[\"nested\", (\"supernested\", (\"key\",))] = torch.zeros(3, 4) # the batch-size must match\n>>> assert (data[\"nested\", \"supernested\", \"key\"] == 0).all()\n>>> assert ((\"nested\",), \"supernested\", ((\"key\",),)) in data.keys(include_nested=True)  # this works too!\n```\n\nYou can also store non-tensor data in tensordicts:\n\n```python\n>>> data = TensorDict({\"a-tensor\": torch.randn(1, 2)}, batch_size=[1, 2])\n>>> data[\"non-tensor\"] = \"a string!\"\n>>> assert data[\"non-tensor\"] == \"a string!\"\n```\n\n### Tensor-like features\n\n**\\[Nightly feature\\]** TensorDict supports many common point-wise arithmetic operations such as `==` or `+`, `+=`\nand similar (provided that the underlying tensors support the said operation):\n```python\n>>> td = TensorDict.fromkeys([\"a\", \"b\", \"c\"], 0)\n>>> td += 1\n>>> assert (td==1).all()\n```\n\nTensorDict objects can be indexed exactly like tensors. The resulting of indexing\na TensorDict is another TensorDict containing tensors indexed along the required dimension:\n```python\n>>> data = TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": torch.zeros(3, 4, 5, dtype=torch.bool),\n... }, batch_size=[3, 4])\n>>> sub_tensordict = data[..., :2]\n>>> assert sub_tensordict.shape == torch.Size([3, 2])\n>>> assert sub_tensordict[\"key 1\"].shape == torch.Size([3, 2, 5])\n```\n\nSimilarly, one can build tensordicts by stacking or concatenating single tensordicts:\n```python\n>>> tensordicts = [TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": torch.zeros(3, 4, 5, dtype=torch.bool),\n... }, batch_size=[3, 4]) for _ in range(2)]\n>>> stack_tensordict = torch.stack(tensordicts, 1)\n>>> assert stack_tensordict.shape == torch.Size([3, 2, 4])\n>>> assert stack_tensordict[\"key 1\"].shape == torch.Size([3, 2, 4, 5])\n>>> cat_tensordict = torch.cat(tensordicts, 0)\n>>> assert cat_tensordict.shape == torch.Size([6, 4])\n>>> assert cat_tensordict[\"key 1\"].shape == torch.Size([6, 4, 5])\n```\n\nTensorDict instances can also be reshaped, viewed, squeezed and unsqueezed:\n```python\n>>> data = TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": torch.zeros(3, 4, 5, dtype=torch.bool),\n... }, batch_size=[3, 4])\n>>> print(data.view(-1))\ntorch.Size([12])\n>>> print(data.reshape(-1))\ntorch.Size([12])\n>>> print(data.unsqueeze(-1))\ntorch.Size([3, 4, 1])\n```\n\nOne can also send tensordict from device to device, place them in shared memory,\nclone them, update them in-place or not, split them, unbind them, expand them etc.\n\nIf a functionality is missing, it is easy to call it using `apply()` or `apply_()`:\n```python\ntensordict_uniform = data.apply(lambda tensor: tensor.uniform_())\n```\n\n``apply()`` can also be great to filter a tensordict, for instance:\n```python\ndata = TensorDict({\"a\": torch.tensor(1.0, dtype=torch.float), \"b\": torch.tensor(1, dtype=torch.int64)}, [])\ndata_float = data.apply(lambda x: x if x.dtype == torch.float else None) # contains only the \"a\" key\nassert \"b\" not in data_float\n```\n\n### Distributed capabilities\n\nComplex data structures can be cumbersome to synchronize in distributed settings.\n`tensordict` solves that problem with synchronous and asynchronous helper methods\nsuch as `recv`, `irecv`, `send` and `isend` that behave like their `torch.distributed`\ncounterparts:\n```python\n>>> # on all workers\n>>> data = TensorDict({\"a\": torch.zeros(()), (\"b\", \"c\"): torch.ones(())}, [])\n>>> # on worker 1\n>>> data.isend(dst=0)\n>>> # on worker 0\n>>> data.irecv(src=1)\n```\n\nWhen nodes share a common scratch space, the\n[`MemmapTensor` backend](https://pytorch.github.io/tensordict/tutorials/tensordict_memory.html)\ncan be used\nto seamlessly send, receive and read a huge amount of data.\n\n### TensorDict for functional programming\n\nWe also provide an API to use TensorDict in conjunction with [FuncTorch](https://pytorch.org/functorch).\nFor instance, TensorDict makes it easy to concatenate model weights to do model ensembling:\n```python\n>>> from torch import nn\n>>> from tensordict import TensorDict\n>>> import torch\n>>> from torch import vmap\n>>> layer1 = nn.Linear(3, 4)\n>>> layer2 = nn.Linear(4, 4)\n>>> model = nn.Sequential(layer1, layer2)\n>>> params = TensorDict.from_module(model)\n>>> # we represent the weights hierarchically\n>>> weights1 = TensorDict(layer1.state_dict(), []).unflatten_keys(\".\")\n>>> weights2 = TensorDict(layer2.state_dict(), []).unflatten_keys(\".\")\n>>> assert (params == TensorDict({\"0\": weights1, \"1\": weights2}, [])).all()\n>>> # Let's use our functional module\n>>> x = torch.randn(10, 3)\n>>> with params.to_module(model):\n...     out = model(x)\n>>> # an ensemble of models: we stack params along the first dimension...\n>>> params_stack = torch.stack([params, params], 0)\n>>> # ... and use it as an input we'd like to pass through the model\n>>> def func(x, params):\n...     with params.to_module(model):\n...         return model(x)\n>>> y = vmap(func, (None, 0))(x, params_stack)\n>>> print(y.shape)\ntorch.Size([2, 10, 4])\n```\n\nMoreover, tensordict modules are compatible with `torch.fx` and (soon) `torch.compile`,\nwhich means that you can get the best of both worlds: a codebase that is\nboth readable and future-proof as well as efficient and portable!\n\n### TensorDict for parameter serialization and building datasets\n\nTensorDict offers an API for parameter serialization that can be >3x faster than\nregular calls to `torch.save(state_dict)`. Moreover, because tensors will be saved\nindependently on disk, you can deserialize your checkpoint on an arbitrary slice\nof the model.\n\n```python\n>>> model = nn.Sequential(nn.Linear(3, 4), nn.Linear(4, 3))\n>>> params = TensorDict.from_module(model)\n>>> params.memmap(\"/path/to/saved/folder/\", num_threads=16)  # adjust num_threads for speed\n>>> # load params\n>>> params = TensorDict.load_memmap(\"/path/to/saved/folder/\", num_threads=16)\n>>> params.to_module(model)  # load onto model\n>>> params[\"0\"].to_module(model[0])  # load on a slice of the model\n>>> # in the latter case we could also have loaded only the slice we needed\n>>> params0 = TensorDict.load_memmap(\"/path/to/saved/folder/0\", num_threads=16)\n>>> params0.to_module(model[0])  # load on a slice of the model\n```\n\nThe same functionality can be used to access data in a dataset stored on disk.\nSoring a single contiguous tensor on disk accessed through the `tensordict.MemoryMappedTensor`\nprimitive and reading slices of it is not only **much** faster than loading\nsingle files one at a time but it's also easier and safer (because there is no pickling\nor third-party library involved):\n\n```python\n# allocate memory of the dataset on disk\ndata = TensorDict({\n    \"images\": torch.zeros((128, 128, 3), dtype=torch.uint8),\n    \"labels\": torch.zeros((), dtype=torch.int)}, batch_size=[])\ndata = data.expand(1000000)\ndata = data.memmap_like(\"/path/to/dataset\")\n# ==> Fill your dataset here\n# Let's get 3 items of our dataset:\ndata[torch.tensor([1, 10000, 500000])]  # This is much faster than loading the 3 images independently\n```\n\n### Preprocessing with TensorDict.map\n\nPreprocessing huge contiguous (or not!) datasets can be done via `TensorDict.map`\nwhich will dispatch a task to various workers:\n\n```python\nimport torch\nfrom tensordict import TensorDict, MemoryMappedTensor\nimport tempfile\n\ndef process_data(data):\n    images = data.get(\"images\").flip(-2).clone()\n    labels = data.get(\"labels\") // 10\n    # we update the td inplace\n    data.set_(\"images\", images)  # flip image\n    data.set_(\"labels\", labels)  # cluster labels\n\nif __name__ == \"__main__\":\n    # create data_preproc here\n    data_preproc = data.map(process_data, num_workers=4, chunksize=0, pbar=True)  # process 1 images at a time\n```\n\n### Lazy preallocation\n\nPre-allocating tensors can be cumbersome and hard to scale if the list of preallocated\nitems varies according to the script configuration. TensorDict solves this in an elegant way.\nAssume you are working with a function `foo() -> TensorDict`, e.g.\n```python\ndef foo():\n    data = TensorDict({}, batch_size=[])\n    data[\"a\"] = torch.randn(3)\n    data[\"b\"] = TensorDict({\"c\": torch.zeros(2)}, batch_size=[])\n    return data\n```\nand you would like to call this function repeatedly. You could do this in two ways.\nThe first would simply be to stack the calls to the function:\n```python\ndata = torch.stack([foo() for _ in range(N)])\n```\nHowever, you could also choose to preallocate the tensordict:\n```python\ndata = TensorDict({}, batch_size=[N])\nfor i in range(N):\n    data[i] = foo()\n```\nwhich also results in a tensordict (when `N = 10`)\n```\nTensorDict(\n    fields={\n        a: Tensor(torch.Size([10, 3]), dtype=torch.float32),\n        b: TensorDict(\n            fields={\n                c: Tensor(torch.Size([10, 2]), dtype=torch.float32)},\n            batch_size=torch.Size([10]),\n            device=None,\n            is_shared=False)},\n    batch_size=torch.Size([10]),\n    device=None,\n    is_shared=False)\n```\nWhen `i==0`, your empty tensordict will automatically be populated with empty tensors\nof batch-size `N`. After that, updates will be written in-place.\nNote that this would also work with a shuffled series of indices (pre-allocation does\nnot require you to go through the tensordict in an ordered fashion).\n\n\n### Nesting TensorDicts\n\nIt is possible to nest tensordict. The only requirement is that the sub-tensordict should be indexable\nunder the parent tensordict, i.e. its batch size should match (but could be longer than) the parent\nbatch size.\n\nWe can switch easily between hierarchical and flat representations.\nFor instance, the following code will result in a single-level tensordict with keys `\"key 1\"` and `\"key 2.sub-key\"`:\n```python\n>>> data = TensorDict({\n...     \"key 1\": torch.ones(3, 4, 5),\n...     \"key 2\": TensorDict({\"sub-key\": torch.randn(3, 4, 5, 6)}, batch_size=[3, 4, 5])\n... }, batch_size=[3, 4])\n>>> tensordict_flatten = data.flatten_keys(separator=\".\")\n```\n\nAccessing nested tensordicts can be achieved with a single index:\n```python\n>>> sub_value = data[\"key 2\", \"sub-key\"]\n```\n\n## TensorClass\n\nContent flexibility comes at the cost of predictability.\nIn some cases, developers may be looking for data structure with a more explicit behavior.\n`tensordict` provides a `dataclass`-like decorator that allows for the creation of custom dataclasses that support\nthe tensordict operations:\n```python\n>>> from tensordict.prototype import tensorclass\n>>> import torch\n>>>\n>>> @tensorclass\n... class MyData:\n...    image: torch.Tensor\n...    mask: torch.Tensor\n...    label: torch.Tensor\n...\n...    def mask_image(self):\n...        return self.image[self.mask.expand_as(self.image)].view(*self.batch_size, -1)\n...\n...    def select_label(self, label):\n...        return self[self.label == label]\n...\n>>> images = torch.randn(100, 3, 64, 64)\n>>> label = torch.randint(10, (100,))\n>>> mask = torch.zeros(1, 64, 64, dtype=torch.bool).bernoulli_().expand(100, 1, 64, 64)\n>>>\n>>> data = MyData(images, mask, label=label, batch_size=[100])\n>>>\n>>> print(data.select_label(1))\nMyData(\n    image=Tensor(torch.Size([11, 3, 64, 64]), dtype=torch.float32),\n    label=Tensor(torch.Size([11]), dtype=torch.int64),\n    mask=Tensor(torch.Size([11, 1, 64, 64]), dtype=torch.bool),\n    batch_size=torch.Size([11]),\n    device=None,\n    is_shared=False)\n>>> print(data.mask_image().shape)\ntorch.Size([100, 6117])\n>>> print(data.reshape(10, 10))\nMyData(\n    image=Tensor(torch.Size([10, 10, 3, 64, 64]), dtype=torch.float32),\n    label=Tensor(torch.Size([10, 10]), dtype=torch.int64),\n    mask=Tensor(torch.Size([10, 10, 1, 64, 64]), dtype=torch.bool),\n    batch_size=torch.Size([10, 10]),\n    device=None,\n    is_shared=False)\n```\nAs this example shows, one can write a specific data structures with dedicated methods while still enjoying the TensorDict\nartifacts such as shape operations (e.g. reshape or permutations), data manipulation (indexing, `cat` and `stack`) or calling\narbitrary functions through the `apply` method (and many more).\n\nTensorclasses support nesting and, in fact, all the TensorDict features.\n\n\n## Installation\n\n**With Pip**:\n\nTo install the latest stable version of tensordict, simply run\n\n```bash\npip install tensordict\n```\n\nThis will work with Python 3.7 and upward as well as PyTorch 1.12 and upward.\n\nTo enjoy the latest features, one can use\n\n```bash\npip install tensordict-nightly\n```\n\n**With Conda**:\n\nInstall `tensordict` from `conda-forge` channel.\n\n```sh\nconda install -c conda-forge tensordict\n```\n\n\n## Citation\n\nIf you're using TensorDict, please refer to this BibTeX entry to cite this work:\n```\n@misc{bou2023torchrl,\n      title={TorchRL: A data-driven decision-making library for PyTorch}, \n      author={Albert Bou and Matteo Bettini and Sebastian Dittert and Vikash Kumar and Shagun Sodhani and Xiaomeng Yang and Gianni De Fabritiis and Vincent Moens},\n      year={2023},\n      eprint={2306.00577},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n}\n```\n\n## Disclaimer\n\nTensorDict is at the *beta*-stage, meaning that there may be bc-breaking changes introduced, but \nthey should come with a warranty.\nHopefully these should not happen too often, as the current roadmap mostly \ninvolves adding new features and building compatibility with the broader\nPyTorch ecosystem.\n\n## License\n\nTensorDict is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": null,
    "version": "2024.4.18",
    "project_urls": {
        "Homepage": "https://github.com/pytorch/tensordict"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6560d4c8e4fd64443f53ff3eea1e602465407925f12a508a44eb95d8a27a24b5",
                "md5": "155f0dd451f7b37799da613d424b2df8",
                "sha256": "322fdb9ae9e73eeb0287ceecbb46c5f8ac2211efd45c6b68a03d800b658b62b4"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp310-cp310-macosx_10_15_x86_64.whl",
            "has_sig": false,
            "md5_digest": "155f0dd451f7b37799da613d424b2df8",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 292377,
            "upload_time": "2024-04-18T13:53:27",
            "upload_time_iso_8601": "2024-04-18T13:53:27.359505Z",
            "url": "https://files.pythonhosted.org/packages/65/60/d4c8e4fd64443f53ff3eea1e602465407925f12a508a44eb95d8a27a24b5/tensordict_nightly-2024.4.18-cp310-cp310-macosx_10_15_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd4d2a32d7c49113b20497797df258866ecfdb36fbbfcadcfd09300190ec9cd1",
                "md5": "287a0767cb6eac1f27aac767325fd497",
                "sha256": "47ec446200deddfdf9a476680b4d70b1a9e37bf02fce62e62d7a9585b68a02fb"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp310-cp310-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "287a0767cb6eac1f27aac767325fd497",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 1076156,
            "upload_time": "2024-04-18T13:53:28",
            "upload_time_iso_8601": "2024-04-18T13:53:28.146023Z",
            "url": "https://files.pythonhosted.org/packages/cd/4d/2a32d7c49113b20497797df258866ecfdb36fbbfcadcfd09300190ec9cd1/tensordict_nightly-2024.4.18-cp310-cp310-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbb7566d6674f2af3823dbbe7900e030e73dd9e415bfdc6af16ab1273f051bd6",
                "md5": "8259e6a3a22a6a1b55a71d9942e1e730",
                "sha256": "baa0bbd446473369b4885493ccf5c6f6721362a7de0a3efa7bc7a211f5c34178"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "8259e6a3a22a6a1b55a71d9942e1e730",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 290352,
            "upload_time": "2024-04-18T13:56:43",
            "upload_time_iso_8601": "2024-04-18T13:56:43.894137Z",
            "url": "https://files.pythonhosted.org/packages/bb/b7/566d6674f2af3823dbbe7900e030e73dd9e415bfdc6af16ab1273f051bd6/tensordict_nightly-2024.4.18-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "273acaf8395c1402585c08d767a1a22a8f8b7bc111b43cde41d510914539f3f5",
                "md5": "6a5adf1e579d75c1e04466d5274b2195",
                "sha256": "7528e65886be96773112ee0b2d0b6129f4d22bce2516cf69d2db3f4d71c18320"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp311-cp311-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "6a5adf1e579d75c1e04466d5274b2195",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 350558,
            "upload_time": "2024-04-18T13:53:09",
            "upload_time_iso_8601": "2024-04-18T13:53:09.516666Z",
            "url": "https://files.pythonhosted.org/packages/27/3a/caf8395c1402585c08d767a1a22a8f8b7bc111b43cde41d510914539f3f5/tensordict_nightly-2024.4.18-cp311-cp311-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d3f16756f0a46168170723c638d19255f54d103164c830fdf24e623e9c99104",
                "md5": "c8a9d90c46c2d382343284569f14050e",
                "sha256": "0ce7a2c4ba129d489819d7bd1c7234fc203967eeb2dfe96ce228016d35e81b6b"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp311-cp311-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "c8a9d90c46c2d382343284569f14050e",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 1096622,
            "upload_time": "2024-04-18T13:53:30",
            "upload_time_iso_8601": "2024-04-18T13:53:30.382724Z",
            "url": "https://files.pythonhosted.org/packages/5d/3f/16756f0a46168170723c638d19255f54d103164c830fdf24e623e9c99104/tensordict_nightly-2024.4.18-cp311-cp311-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d97d65aa063b1f3ee5eeafda83b821ad22a1ba386e44cc98cc891fc96909bb8e",
                "md5": "6700af9a5a63c77f7453d8a29ca15148",
                "sha256": "4d445fa13694bb9d7cfd81230c345de6daf2fa01f13722bd357fa3b8558cc92b"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "6700af9a5a63c77f7453d8a29ca15148",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 291177,
            "upload_time": "2024-04-18T13:56:45",
            "upload_time_iso_8601": "2024-04-18T13:56:45.700729Z",
            "url": "https://files.pythonhosted.org/packages/d9/7d/65aa063b1f3ee5eeafda83b821ad22a1ba386e44cc98cc891fc96909bb8e/tensordict_nightly-2024.4.18-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44fa077b84e6e404cf8160750b1f3ad5ea18d64e9e10a1bdb1329dd5a9bf2a0b",
                "md5": "10d0cbf86f66c3d4716963db2a556db3",
                "sha256": "57d886dfcf3201b8e98bd726c6c014a501f3951d205f24d17840082db57caa5b"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp38-cp38-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "10d0cbf86f66c3d4716963db2a556db3",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": null,
            "size": 292289,
            "upload_time": "2024-04-18T13:53:05",
            "upload_time_iso_8601": "2024-04-18T13:53:05.659951Z",
            "url": "https://files.pythonhosted.org/packages/44/fa/077b84e6e404cf8160750b1f3ad5ea18d64e9e10a1bdb1329dd5a9bf2a0b/tensordict_nightly-2024.4.18-cp38-cp38-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b0b16350f0a11812e8c20c87f3c722c3593fd2c8efa33e1687e548367d29fc4f",
                "md5": "ea5eb43a3ff9ceb8b0e32ff8cdaec8e7",
                "sha256": "5aa53ee0a8649078bf5a0b8398903b5a5baeb65a5226e030a4e8e24c4ed237d5"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp38-cp38-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ea5eb43a3ff9ceb8b0e32ff8cdaec8e7",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": null,
            "size": 1077790,
            "upload_time": "2024-04-18T13:53:26",
            "upload_time_iso_8601": "2024-04-18T13:53:26.949573Z",
            "url": "https://files.pythonhosted.org/packages/b0/b1/6350f0a11812e8c20c87f3c722c3593fd2c8efa33e1687e548367d29fc4f/tensordict_nightly-2024.4.18-cp38-cp38-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52f39d29dcb2a8401b704977977b0275a26adae4a242cedb6a4086ddd8700f60",
                "md5": "d6e0a0a44b707fa27684ef281bfbfa14",
                "sha256": "16ebec85c875576a30ed60eb32aeb4cb4461476d5de176daf93635090af40bd8"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d6e0a0a44b707fa27684ef281bfbfa14",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": null,
            "size": 290368,
            "upload_time": "2024-04-18T13:56:44",
            "upload_time_iso_8601": "2024-04-18T13:56:44.490939Z",
            "url": "https://files.pythonhosted.org/packages/52/f3/9d29dcb2a8401b704977977b0275a26adae4a242cedb6a4086ddd8700f60/tensordict_nightly-2024.4.18-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62e7dd277467a39197c38c39d1cb034f6a1bf01af7203ece02c443813329cc49",
                "md5": "a5ff6bfe61ea0cee439af8224a41c580",
                "sha256": "25e0164ff01597ab76ed99644a8b7dd2ec620c0ff00b41f73e21af06c08e3d71"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp39-cp39-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a5ff6bfe61ea0cee439af8224a41c580",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 292510,
            "upload_time": "2024-04-18T13:53:07",
            "upload_time_iso_8601": "2024-04-18T13:53:07.403462Z",
            "url": "https://files.pythonhosted.org/packages/62/e7/dd277467a39197c38c39d1cb034f6a1bf01af7203ece02c443813329cc49/tensordict_nightly-2024.4.18-cp39-cp39-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69136542b0b64d39a83468d9259e27ffa62899cc4017aa3b8dc23304bfce9adb",
                "md5": "34eca9e2548effa1620e2ede7487a441",
                "sha256": "964cb3d6275f5bc4a0d60771a898da3dc4b6d91d2bbe5976380a4a8034ec3f7e"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp39-cp39-manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "34eca9e2548effa1620e2ede7487a441",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 1075143,
            "upload_time": "2024-04-18T13:53:28",
            "upload_time_iso_8601": "2024-04-18T13:53:28.141471Z",
            "url": "https://files.pythonhosted.org/packages/69/13/6542b0b64d39a83468d9259e27ffa62899cc4017aa3b8dc23304bfce9adb/tensordict_nightly-2024.4.18-cp39-cp39-manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc3e88301f8b3f5d19021614cfe0f5d6dbfae9fd73ca802b3297a23214cfdc16",
                "md5": "df625cde488f30ffdd6cdc86cdea4bdd",
                "sha256": "5a2a4e93dcbc0a68d2149a844ebafdc8342add1b2e6ce834d65be15308ffdb14"
            },
            "downloads": -1,
            "filename": "tensordict_nightly-2024.4.18-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "df625cde488f30ffdd6cdc86cdea4bdd",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 290639,
            "upload_time": "2024-04-18T13:56:49",
            "upload_time_iso_8601": "2024-04-18T13:56:49.370715Z",
            "url": "https://files.pythonhosted.org/packages/cc/3e/88301f8b3f5d19021614cfe0f5d6dbfae9fd73ca802b3297a23214cfdc16/tensordict_nightly-2024.4.18-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 13:53:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pytorch",
    "github_project": "tensordict",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tensordict-nightly"
}
        
Elapsed time: 0.27426s