torchgear
Utility extensions for PyTorch: tensor math helpers, shape utilities, and nn.Module mixins for device/dtype consistency and parameter freezing.
Requirements
- Python 3.12+
- PyTorch 2.0+
Installation
pip install torchgear
Install from source:
git clone https://github.com/GjQAQ/torchgear.git
cd torchgear
pip install -e .
Quick start
import torch
import torchgear as tg
import torch.nn as nn
# Math helpers
z = torch.tensor([1 + 2j, 3 + 4j])
tg.abs2(z)
# Module base class
class MyModel(tg.TorchgearModule):
def __init__(self):
super().__init__()
self.w = nn.Parameter(torch.randn(4))
def forward(self, x):
return x @ self.w
model = MyModel()
model.freeze()
Documentation
Online documentation: https://gjqaq.github.io/torchgear/
API reference and guides are also in the docs/ directory. Build locally with uv (install uv first):
uv sync --group doc
cd docs && make html
Without uv, install sphinx and furo, then run make html in docs/.
Development
Requires uv (see link above to install):
uv sync --group test
pytest
Without uv, install pytest and run pytest from the project root.
License
MIT License. See LICENSE for details.
Metadata
Release files for torchgear 0.2.0
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 |
|---|---|---|---|---|
| torchgear-0.2.0.tar.gz | 16.9 kB | Without provenance | Details for torchgear-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torchgear-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for torchgear-0.2.0-py3-none-any.whl |
Total release size: 30.8 kB
Release files / torchgear-0.2.0.tar.gz
| Download URL | torchgear-0.2.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9ab893e2e26728d414da2fc3e8bcebe99a0665baed3fbdf0e9d74e904bfa29d
|
|
BLAKE2b-256 checksum How to use checksums |
6baff3090f784394155b268870183dfca4f3b0308c21cb86554327459a80fa39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / torchgear-0.2.0-py3-none-any.whl
| Download URL | torchgear-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55561521384654d7a2344f4c4ce15ef861388e30401bbc305586618ecb0b7121
|
|
BLAKE2b-256 checksum How to use checksums |
4fb912c3c4e755e8e9e2e900ff68ce8124c8be03bfc6200583bf14bfbbe681c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for torchgear 0.2.0
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.