Home / Function/ load_yaml_file() — pytorch Function Reference

load_yaml_file() — pytorch Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  64baff95_4e12_649c_3bb5_b00ba5c32d8e["load_yaml_file()"]
  cedcce8c_7b00_0c01_3376_b992774da756["_config()"]
  cedcce8c_7b00_0c01_3376_b992774da756 -->|calls| 64baff95_4e12_649c_3bb5_b00ba5c32d8e
  style 64baff95_4e12_649c_3bb5_b00ba5c32d8e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/common.py lines 252–278

def load_yaml_file(filename):
    filepath = os.path.join(os.path.dirname(__file__), filename)

    with open(filepath) as f:
        data = yaml.safe_load(f)

    internal_file_path = os.path.join(os.path.dirname(__file__), "fb", filename)
    if os.path.exists(internal_file_path):
        with open(internal_file_path) as f:
            internal_data = yaml.safe_load(f)
            data.update(internal_data)

    def flatten(lst):
        for item in lst:
            if isinstance(item, list):
                yield from flatten(item)
            else:
                yield item

    def maybe_list_to_set(obj):
        if isinstance(obj, dict):
            return {k: maybe_list_to_set(v) for k, v in obj.items()}
        if isinstance(obj, list):
            return set(flatten(obj))
        return obj

    return maybe_list_to_set(data)

Subdomains

Called By

Frequently Asked Questions

What does load_yaml_file() do?
load_yaml_file() is a function in the pytorch codebase.
What calls load_yaml_file()?
load_yaml_file() is called by 1 function(s): _config.

Analyze Your Own Codebase

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

Try Supermodel Free