Skip to main content

Torch Prisma

Measure PyTorch inference latency, parameters, MACs, and FLOPs on CPU, CUDA, and Huawei Ascend.

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

# For inference, set the model to evaluation mode and place it and the inputs on the device.
device = "cpu"
model = nn.Linear(8, 4).eval().to(device)
x = torch.randn(2, 8, device=device)

complexity = calculate_model_complexity(model, x)
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.0

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.0
File Size Uploaded Provenance Actions
torch_prisma-0.1.0.tar.gz 21.2 kB With provenance Details for torch_prisma-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 36.7 kB

Release files / torch_prisma-0.1.0.tar.gz

Download URL torch_prisma-0.1.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b75d401e716b0762def4236edca375bafad1df484aa232423c5b4bef72947ab
BLAKE2b-256 checksum
How to use checksums
286d7aa8f27948c20498a891cdd40992785b4be5697fee35d1f969b7fccb033d
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 9, 2026.

Transparency log

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

Download URL torch_prisma-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ba29157f2dedce4149621092a7af9d7d29a1216a07c8b6ebd1e909c88ee0c90
BLAKE2b-256 checksum
How to use checksums
982e988f83a44cce77edb2e149f5adbab1d7f2e6ab3760a679d54d5957ce7533
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 9, 2026.

Transparency log

Security for torch-prisma 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for torch_prisma-0.1.0.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 9, 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