Skip to main content

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.1

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-prisma 0.1.1
File Size Uploaded Provenance Actions
torch_prisma-0.1.1.tar.gz 20.5 kB With provenance Details for torch_prisma-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torch-prisma 0.1.1
File Interpreter ABI Platform Actions
torch_prisma-0.1.1-py3-none-any.whl Python 3 none any Details for torch_prisma-0.1.1-py3-none-any.whl

Total release size: 36.0 kB

Release files / torch_prisma-0.1.1.tar.gz

Download URL torch_prisma-0.1.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5eda7815ce1f896dc1412f55fc3369806e67f3f4a5f6895156dd543fa2bad886
BLAKE2b-256 checksum
How to use checksums
08e46632fbd6ba48e755dacb4f86118664a0ec96ece6e63d8d129c91a78ddbb6
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 log

Release files / torch_prisma-0.1.1-py3-none-any.whl

Download URL torch_prisma-0.1.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fc2717f831fadb6e6e3d0801a2abb4c282f91fe5dbae7299e08c373b59b4ed1
BLAKE2b-256 checksum
How to use checksums
8247c3396925cba4ad518bffa3a114fa7b4f6b1038023f75b036e5ddd09c9687
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 log

Security for torch-prisma 0.1.1

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.

Select from 2 files

Attestation for torch_prisma-0.1.1.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 log

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.

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