Home / Function/ coverage_experiment() — pytorch Function Reference

coverage_experiment() — pytorch Function Reference

Architecture documentation for the coverage_experiment() function in common.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  1bdb2766_1dfd_f7e0_5a58_c0b0c698068f["coverage_experiment()"]
  c9be2096_e6d7_2374_ad2e_a6e33f435ada["run()"]
  1bdb2766_1dfd_f7e0_5a58_c0b0c698068f -->|calls| c9be2096_e6d7_2374_ad2e_a6e33f435ada
  3473d1a5_c1f5_fc97_006e_79a1d3081bef["write_outputs()"]
  1bdb2766_1dfd_f7e0_5a58_c0b0c698068f -->|calls| 3473d1a5_c1f5_fc97_006e_79a1d3081bef
  style 1bdb2766_1dfd_f7e0_5a58_c0b0c698068f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/common.py lines 806–839

def coverage_experiment(args, model_iter_fn, model, example_inputs, **kwargs):
    """
    Test operator/model coverage of TorchDynamo and record statistics
    taken from a profiler.  This target is mainly intended to check
    correctness.

    Writes to ./coverage.csv
    """
    profiler = Profiler()
    frozen_model_iter_fn = torch._dynamo.run(model_iter_fn)
    with profiler.prof:
        frozen_model_iter_fn(model, example_inputs)
    coverage_result = profiler.results()
    write_outputs(
        output_filename,
        (
            "dev",
            "name",
            "batch_size",
            "graphs",
            "graph_calls",
            "captured_ops",
            "total_ops",
            "pct_ops",
            "pct_time",
        ),
        [
            current_device,
            current_name,
            current_batch_size,
        ]
        + coverage_result.tocsv(),
    )
    return coverage_result

Subdomains

Frequently Asked Questions

What does coverage_experiment() do?
coverage_experiment() is a function in the pytorch codebase.
What does coverage_experiment() call?
coverage_experiment() calls 2 function(s): run, write_outputs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free