Skip to content

TorchScan v0.2.0: structured reports and explicit measurement completeness

Latest

Choose a tag to compare

@frgfm frgfm released this 03 Oct 20:38
2b9fb38

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

Highlights

  • summary() retains the terminal table and returns the structured AnalysisReport.
  • crawl_module() accepts complete args and kwargs, 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=True rejects incomplete requested metrics with IncompleteAnalysisError.
  • 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 use method="not_requested".
  • Crawling restores each module's original training flag, removes hooks after failures, and releases intermediate activations during execution.

Migration

  • Replace input_data with args and kwargs.
  • Replace raw totals with the new MetricResult fields. Check status: use value for complete metrics and known_value only as a lower bound for partial metrics.
  • Replace parsing printed summaries with reading the report directly.
  • get_process_gpu_ram and report overheads have 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.