Home / Function/ parse_args() — pytorch Function Reference

parse_args() — pytorch Function Reference

Architecture documentation for the parse_args() function in benchmarks.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  f6997f23_fa92_edba_2dc0_4e174f309eb9["parse_args()"]
  815a46f9_d548_98bf_cbd7_cb9fae326824["args()"]
  815a46f9_d548_98bf_cbd7_cb9fae326824 -->|calls| f6997f23_fa92_edba_2dc0_4e174f309eb9
  af74d132_8840_19ff_d394_8c73872d97c9["__init__()"]
  f6997f23_fa92_edba_2dc0_4e174f309eb9 -->|calls| af74d132_8840_19ff_d394_8c73872d97c9
  style f6997f23_fa92_edba_2dc0_4e174f309eb9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/benchmarks.py lines 59–86

def parse_args(args=None):
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--only",
        help="""Run just one model from whichever model suite it belongs to. Or
        specify the path and class name of the model in format like:
        --only=path:<MODEL_FILE_PATH>,class:<CLASS_NAME>

        Due to the fact that dynamo changes current working directory,
        the path should be an absolute path.

        The class should have a method get_example_inputs to return the inputs
        for the model. An example looks like
        ```
        class LinearModel(nn.Module):
            def __init__(self):
                super().__init__()
                self.linear = nn.Linear(10, 10)

            def forward(self, x):
                return self.linear(x)

            def get_example_inputs(self):
                return (torch.randn(2, 10),)
        ```
    """,
    )
    return parser.parse_known_args(args)

Subdomains

Calls

Called By

Frequently Asked Questions

What does parse_args() do?
parse_args() is a function in the pytorch codebase.
What does parse_args() call?
parse_args() calls 1 function(s): __init__.
What calls parse_args()?
parse_args() is called by 1 function(s): args.

Analyze Your Own Codebase

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

Try Supermodel Free