mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: It'll be easier to generate examples if the code doesn't depend on exportdb library. Test Plan: CI Differential Revision: D58886554 Pull Request resolved: https://github.com/pytorch/pytorch/pull/129260 Approved by: https://github.com/tugsbayasgalan
22 lines
462 B
Python
22 lines
462 B
Python
import os
|
|
import sys
|
|
|
|
import torch._export.db.examples as examples
|
|
|
|
TEMPLATE = '''import torch
|
|
|
|
def {case_name}(x):
|
|
"""
|
|
"""
|
|
|
|
return
|
|
'''
|
|
|
|
if __name__ == "__main__":
|
|
assert len(sys.argv) == 2
|
|
root_dir = examples.__name__.replace(".", "/")
|
|
assert os.path.exists(root_dir)
|
|
with open(os.path.join(root_dir, sys.argv[1] + ".py"), "w") as f:
|
|
print("Writing to", f.name, "...")
|
|
f.write(TEMPLATE.format(case_name=sys.argv[1]))
|