Torch Prisma
Measure PyTorch inference latency, parameters, MACs, and FLOPs on CPUs and accelerators.
Installation
Requires Python 3.10+ and PyTorch 2.6+. Install in a virtual environment.
uv pip install torch-prisma
Usage
Latency uses torch.compile by default. Set compile=False for eager timing.
import torch
from torch import nn
from torch_prisma import calculate_model_complexity, measure_module_latency
# Set evaluation mode and place the model and inputs on the device before measuring.
device = "cpu"
model = nn.Linear(8, 4).eval().to(device)
x = torch.randn(2, 8, device=device)
complexity = calculate_model_complexity(model, x)
# Forward side effects are not managed. Pass deep copies of the model and inputs if needed.
latency = measure_module_latency(model, x, device=device)
print(complexity.params, complexity.macs, complexity.flops)
# Operations with incomplete counts, grouped by MACs and FLOPs.
print(complexity.uncovered_ops)
print(latency.median_ms)
Measurement API · Latency benchmarks · Huawei Ascend
Development
uv sync
uv run pre-commit install
uv run pytest
uv build
Preview the documentation with uv run --group docs zensical serve.
License
Torch Prisma is distributed under the MIT License.
Metadata
Release files for torch-prisma 0.1.2
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 |
|---|---|---|---|---|
| torch_prisma-0.1.2.tar.gz | 20.4 kB | With provenance | Details for torch_prisma-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_prisma-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for torch_prisma-0.1.2-py3-none-any.whl |
Total release size: 35.9 kB
Release files / torch_prisma-0.1.2.tar.gz
| Download URL | torch_prisma-0.1.2.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c41903fe8e5658bcd35ee28f1f3deaa9cc8cccbcbd956d54a120d58e3c8845a
|
|
BLAKE2b-256 checksum How to use checksums |
b055c61c5551f7cfeed91d08781cb9975ae2dadd998a50ac18778bdf32a9c079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / torch_prisma-0.1.2-py3-none-any.whl
| Download URL | torch_prisma-0.1.2-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa941cad0e2842ed36aef89eecf3d23b4d040e18c2d0c6f160b1476b76a594ba
|
|
BLAKE2b-256 checksum How to use checksums |
4c44548ad752d0a8c5bf4773ae181fc2a6ac996b89644adc37fedc46e6282b3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logSecurity for torch-prisma 0.1.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for torch_prisma-0.1.2.tar.gz
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 Nov 10, 2026.
Transparency logA 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.