Helpful utilities for working with PyTorch.
Project description
torch-things
A collection of useful PyTorch utilities and dataset helpers.
Installation
pip install torch-things
Features
DelegatingSubset
A PyTorch dataset subset class that properly delegates all dataset attributes to the underlying dataset. This is particularly useful when working with datasets that have custom attributes that need to be preserved when creating subsets.
from torch_things.dataset import DelegatingSubset
from torch.utils.data import Dataset
# Create your dataset
class MyDataset(Dataset):
def __init__(self):
self.data = torch.randn(100, 3, 32, 32)
self.targets = torch.randint(0, 10, (100,))
self.classes = ['class1', 'class2', 'class3'] # Custom attribute
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
return self.data[idx], self.targets[idx]
# Create a subset that preserves all attributes
dataset = MyDataset()
subset = DelegatingSubset(dataset, indices=[0, 1, 2, 3])
# Access custom attributes from the subset
print(subset.classes) # ['class1', 'class2', 'class3']
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_things-0.0.7.tar.gz.
File metadata
- Download URL: torch_things-0.0.7.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ce726afd9637981603f799ee217f90b75b3bb3c3629d20613b0a4ac28a9c13e
|
|
| MD5 |
3b6651f1882dc31cf53d655a478af950
|
|
| BLAKE2b-256 |
cbecb32c06f2ca1ba7043079156bd875338f918f6491e6f8e04eef93501b064e
|
Provenance
The following attestation bundles were made for torch_things-0.0.7.tar.gz:
Publisher:
publish.yml on dwahdany/torch-things
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_things-0.0.7.tar.gz -
Subject digest:
9ce726afd9637981603f799ee217f90b75b3bb3c3629d20613b0a4ac28a9c13e - Sigstore transparency entry: 189762926
- Sigstore integration time:
-
Permalink:
dwahdany/torch-things@2be89e102ff73ff0d53c384dd3d3aaab37604dcc -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/dwahdany
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2be89e102ff73ff0d53c384dd3d3aaab37604dcc -
Trigger Event:
push
-
Statement type:
File details
Details for the file torch_things-0.0.7-py3-none-any.whl.
File metadata
- Download URL: torch_things-0.0.7-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6324da686e1b5659c9c9c9fa5e340d12e038e89d2131105e2d9f7145edda6256
|
|
| MD5 |
732f294defd778171e379d4212ec606e
|
|
| BLAKE2b-256 |
c89efd67da4c03b28da94c4a35b607cbc0e422d404b064738184f674e2b4c7ed
|
Provenance
The following attestation bundles were made for torch_things-0.0.7-py3-none-any.whl:
Publisher:
publish.yml on dwahdany/torch-things
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_things-0.0.7-py3-none-any.whl -
Subject digest:
6324da686e1b5659c9c9c9fa5e340d12e038e89d2131105e2d9f7145edda6256 - Sigstore transparency entry: 189762927
- Sigstore integration time:
-
Permalink:
dwahdany/torch-things@2be89e102ff73ff0d53c384dd3d3aaab37604dcc -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/dwahdany
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2be89e102ff73ff0d53c384dd3d3aaab37604dcc -
Trigger Event:
push
-
Statement type: