xref: /aosp_15_r20/external/pytorch/test/forward_backward_compatibility/dump_all_function_schemas.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1import argparse
2
3import torch
4
5
6def dump(filename):
7    schemas = torch._C._jit_get_all_schemas()
8    schemas += torch._C._jit_get_custom_class_schemas()
9    with open(filename, "w") as f:
10        for s in schemas:
11            f.write(str(s))
12            f.write("\n")
13
14
15if __name__ == "__main__":
16    parser = argparse.ArgumentParser(description="Process some integers.")
17    parser.add_argument(
18        "-f",
19        "--filename",
20        help="filename to dump the schemas",
21        type=str,
22        default="schemas.txt",
23    )
24    args = parser.parse_args()
25    dump(args.filename)
26