torchstruct
Wrap your multiple torch.Tensors into single TensorStruct
and use it like you are using torch.Tensor.
Installation
pip install torchstruct
Testing
PYTHONPATH=. pytest
Examples
import torch
from torchstruct import TensorStruct
# Initialization
ts = TensorStruct.zeros({
'obs': (2,),
'rew': (1,),
'done': (1,)
}, prefix_shape=(10,), dtype=torch.float32, device='cpu')
raw_data = {
'obs': torch.randn((10, 2)),
'rew': torch.randn((10, 1)),
'done': torch.randn((10, 1))
}
# Assigning
ts[:] = raw_data
# Indexing
ts[2:4]
ts['rew']
# Calling PyTorch methods
ts.unsqueeze(dim=0)
ts.sum(dim=0)
Metadata
Release files for torchstruct 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torchstruct-0.1.6.tar.gz | 5.8 kB | Without provenance | Details for torchstruct-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torchstruct-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for torchstruct-0.1.6-py3-none-any.whl |
Total release size: 10.8 kB
Release files / torchstruct-0.1.6.tar.gz
| Download URL | torchstruct-0.1.6.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aca3caaf4b05a399aaa6e69198e8d056caac6cfd5434e47b1b9b37b3d0e1ef68
|
|
BLAKE2b-256 checksum How to use checksums |
09c8216291e49d68ed2b923f5c2de8d8a63ad39decdf30f418bc444920599280
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.3
|
Release files / torchstruct-0.1.6-py3-none-any.whl
| Download URL | torchstruct-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1b1019be87ec2de0387b9909d496039dc5583e8f7f678a85d87658b73ed64ff
|
|
BLAKE2b-256 checksum How to use checksums |
91118cf4a900141fb491f972c397fab960c88bc3f3040ea09c80521ad1c2825f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.3
|
Security for torchstruct 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.