nanodrr
A performance-oriented reimplementation of DiffDRR with the following improvements:
- Optimized, pure PyTorch implementation (~5× faster than
DiffDRRat baseline) - Fused Triton rendering kernel, used by default on CUDA (up to ~80× faster than
DiffDRR) - Modular design (freely swap subjects, extrinsics, and intrinsics during rendering)
- Compatibility with
torch.compileand mixed precision - Extensive type hints with
jaxtyping - Standard Python package structure managed with
uv
All projective geometry is implemented internally using the standard Hartley and Zisserman pinhole camera formulation.
Installation
[!NOTE]
On
pytorch<2.9,torch.compilewithbfloat16is slower than eager for the pure PyTorch backend due to a CUDA graph capture issue (see Benchmarks). The fused Triton backend is unaffected.
To strictly install the renderer:
pip install nanodrr
To install the optional plotting or 3D visualization module:
pip install "nanodrr[plot]" # 2D visualization (matplotlib, opencv)
pip install "nanodrr[scene]" # 3D visualization (VTK, PyVista)
pip install "nanodrr[all]" # All extras
Benchmarks
[!IMPORTANT]
- ~5× faster than
DiffDRRwith the pure PyTorch backend (1,093 FPS vs 223 FPS)- ~57× faster with the fused Triton kernel, without compilation (12,600 FPS vs 223 FPS)
- ~80× faster with
torch.compileandbfloat16(17,820 FPS vs 223 FPS)- ~3.5× less memory than
DiffDRR(322 MB vs 1,170 MB peak reserved withbfloat16+ compile)
FPS computed from per-frame GPU kernel time (
torch.profiler); median wall-clock timings are also recorded intests/benchmark/benchmark.csv. Benchmarked by rendering 200×200 DRRs on an NVIDIA RTX 6000 Ada (48 GB) with Python 3.12. Compile representstorch.compile(mode="reduce-overhead", fullgraph=True). Full experiment attests/benchmark/.
Docs
To test the docs locally, run
uv run --group docs jupyter nbconvert --to markdown tutorials/*.ipynb --output-dir docs/tutorials/
uv run --group docs zensical serve
Roadmap
- Implement a fully optimized renderer
- Port strictly necessary modules from
DiffDRR(e.g., SE(3) utilities, loss functions, and 2D plotting) - Migrate 3D plotting functions to an optional module
- Integrate with
xvrto speed up network training and registration - Integrate with
polyposeto speed up registration - Release as
v1.0.0ofDiffDRR!
Metadata
Release files for nanodrr 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nanodrr-0.1.6.tar.gz | 31.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nanodrr-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.2 kB
Release files / nanodrr-0.1.6.tar.gz
| Download URL | nanodrr-0.1.6.tar.gz |
|---|---|
| Size | 31.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c31ea91baa45c506a59baafd78fd872023296ad06f87f1148c7e12067a4b5d16
|
|
BLAKE2b-256 checksum How to use checksums |
e4f18ac01e75620f656012912fe432a3024beebeab9f9ce939a7feaebb5da1e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 19, 2026.
Transparency logRelease files / nanodrr-0.1.6-py3-none-any.whl
| Download URL | nanodrr-0.1.6-py3-none-any.whl |
|---|---|
| Size | 42.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0aea39969d48d3d1b45e4c2b6cc8cf65e10b0e202c48721c2bd8e1a293d38b23
|
|
BLAKE2b-256 checksum How to use checksums |
c11f5b62e8fc8a9c3b67e4b82449ddecabad0cbed85f0ab680c469a821a7d284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 19, 2026.
Transparency log