MCPcopy Create free account
hub / github.com/pytorch/executorch / parse_et_yaml

Function parse_et_yaml

codegen/parse.py:125–149  ·  view source on GitHub ↗

Parse native_functions.yaml into NativeFunctions and an Operator Indexed Dict of fields to persist from native_functions.yaml to functions.yaml

(
    path: str,
    tags_yaml_path: str,
    ignore_keys: set[DispatchKey] | None = None,
    skip_native_fns_gen: bool = False,
)

Source from the content-addressed store, hash-verified

123
124
125def parse_et_yaml(
126 path: str,
127 tags_yaml_path: str,
128 ignore_keys: set[DispatchKey] | None = None,
129 skip_native_fns_gen: bool = False,
130) -> tuple[list[NativeFunction], dict[OperatorName, dict[str, Any]]]:
131 """Parse native_functions.yaml into NativeFunctions and an Operator Indexed Dict
132 of fields to persist from native_functions.yaml to functions.yaml
133 """
134 with open(path) as f:
135 es = yaml.load(f, Loader=LineLoader)
136
137 et_kernel = extract_kernel_fields(es)
138
139 # Remove ET specific fields from entries for BC compatibility
140 strip_et_fields(es)
141
142 native_yaml = parse_native_yaml(
143 path,
144 tags_yaml_path,
145 ignore_keys,
146 skip_native_fns_gen=skip_native_fns_gen,
147 loaded_yaml=es,
148 )
149 return native_yaml.native_functions, et_kernel
150
151
152def strip_et_fields(es: object) -> None:

Callers 1

translate_native_yamlFunction · 0.85

Calls 3

extract_kernel_fieldsFunction · 0.85
strip_et_fieldsFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected