TorchScan
Use the smallest API that answers the request:
crawl_module(...): JSON-serializable module report.summary(...): printed table plus the same report.measure_flops(workload): operator FLOPs for one zero-argument workload call.measure_peak_memory(workload, device=...): backend-specific PyTorch peak memory.compare_reports(before, after): pure same-schema comparison.
Workflow
- Reuse the project's model and representative inputs. Do not download weights without permission.
- Prefer
argsandkwargsfor real calls; useinput_shapeonly for simple synthetic tensors. - Use
strict=Truewhen incomplete module metrics must stop automation. - Serialize the report directly. Never parse the
summarytable. - Check every metric's
statusand preserve diagnostics. - Ask the owner for thresholds. TorchScan measures; it does not decide whether a model fits.
Truth rules
complete: usevaluewith its method, unit, scope, and context.partial:known_valueis only a lower bound; do not extrapolate.unavailable: report that no measurement was produced.- Zero is valid only with
status == "complete". - Keep module FLOPs and operator FLOPs separate.
- Peak PyTorch memory is not process RSS or total device memory.
- Mocked or skipped CUDA/MPS checks are not hardware evidence.
For an uncounted operator, preserve the partial result. Rerun the equivalent workload with
measure_flops(..., custom_mapping=...) only when the owner can justify that operator's counting convention;
crawl_module does not accept custom mappings. Do not create a global registry, baseline store, wrapper service, or
automatic budget policy.
In a repository checkout, read ../../../docs/docs/agent-quickstart.md for the full workflow and
../../../docs/docs/report-schema.md for the report contract. Outside a checkout, use the published documentation at
https://frgfm.github.io/torch-scan/.