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

Function generate_header

kernels/test/gen_supported_features.py:22–38  ·  view source on GitHub ↗

Generates a supported features header file

(d: dict)

Source from the content-addressed store, hash-verified

20
21
22def generate_header(d: dict):
23 """Generates a supported features header file"""
24 ini_path = os.path.join(
25 os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))),
26 "supported_features_header.ini",
27 )
28 if os.path.isfile(ini_path):
29 header_file = open(ini_path, encoding="utf-8").read()
30 else:
31 assert (
32 __package__ is not None
33 ), "Can't find supported_features_header.ini when __package__ is None."
34 header_file = _resources.read_text(
35 __package__, "supported_features_header.ini", encoding="utf-8"
36 )
37
38 return header_file.replace("$header_entries", "".join(generate_header_entry(d)))
39
40
41def generate_header_entry(d: dict):

Callers 2

test_gen_headerMethod · 0.90
mainFunction · 0.85

Calls 1

generate_header_entryFunction · 0.85

Tested by 1

test_gen_headerMethod · 0.72