Repository navigation
TorchScan now returns versioned, JSON-serializable model reports for human inspection and automation. Unsupported work produces partial or unavailable metrics with diagnostics instead of contributing an unexplained zero.
This is a breaking release. It requires Python >=3.11,<4 and PyTorch >=2.1,<3.0. Follow the v0.2 migration guide when upgrading from 0.1.
Install or upgrade:
pip install --upgrade torchscan==0.2.0Highlights
summary()retains the terminal table and returns the structuredAnalysisReport.crawl_module()accepts completeargsandkwargs, including nested inputs, masks, and non-tensor values.- Module-formula FLOPs and PyTorch-native operator FLOPs are reported separately. Neither is a latency measurement; do not add the two totals.
strict=Truerejects incomplete requested metrics withIncompleteAnalysisError.measure_flops()measures a caller-controlled workload, supports per-call custom formulas, and identifies uncounted operators.measure_peak_memory()reports backend-specific PyTorch workload memory. It is not process RSS or total device memory.compare_reports()compares compatible reports and propagates incomplete results.mode="structure"collects hierarchy, calls, shapes, parameters, and buffers without compute analysis. Unrequested compute metrics usemethod="not_requested".- Crawling restores each module's original training flag, removes hooks after failures, and releases intermediate activations during execution.
Migration
- Replace
input_datawithargsandkwargs. - Replace raw totals with the new
MetricResultfields. Checkstatus: usevaluefor complete metrics andknown_valueonly as a lower bound for partial metrics. - Replace parsing printed summaries with reading the report directly.
get_process_gpu_ramand reportoverheadshave been removed.
Documentation
Validation
Tag v0.2.0 points to 2b9fb38. The release workflow built the attached 0.2.0 wheel and source archive from this commit, changing only the package version during the build. Both archives' package source files match the tagged commit.
Release checks passed: 170 tests (7 skipped), minimum/latest PyTorch compatibility, 3 model smokes, installation checks across Linux/macOS/Windows with Python 3.11–3.14, and wheel/source-archive API verification. Documentation CI also passed.
Published torchscan 0.2.0 on PyPI through GitHub Actions trusted publishing. All 12 post-publication installation checks passed across Linux, macOS, and Windows with Python 3.11–3.14. The published wheel and source archive have the same SHA-256 checksums as the attached release artifacts.