Skip to main content

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']

Metadata

Release files for torch-things 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-things 0.0.7
File Size Uploaded
torch_things-0.0.7.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torch-things 0.0.7
File Interpreter ABI Platform
torch_things-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / torch_things-0.0.7.tar.gz

Download URL torch_things-0.0.7.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ce726afd9637981603f799ee217f90b75b3bb3c3629d20613b0a4ac28a9c13e
BLAKE2b-256 checksum
How to use checksums
cbecb32c06f2ca1ba7043079156bd875338f918f6491e6f8e04eef93501b064e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2025.

Transparency log

Release files / torch_things-0.0.7-py3-none-any.whl

Download URL torch_things-0.0.7-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6324da686e1b5659c9c9c9fa5e340d12e038e89d2131105e2d9f7145edda6256
BLAKE2b-256 checksum
How to use checksums
c89efd67da4c03b28da94c4a35b607cbc0e422d404b064738184f674e2b4c7ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page