mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
Summary: This will support another round of migration from hand-written configs to code generation. Pull Request resolved: https://github.com/pytorch/pytorch/pull/38496 Differential Revision: D21581624 Pulled By: kostmo fbshipit-source-id: aed814ef6d4fc6af9ce092727b2dacc99de14ae0
25 lines
519 B
Python
Executable File
25 lines
519 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import yaml
|
|
|
|
# Need to import modules that lie on an upward-relative path
|
|
sys.path.append(os.path.join(sys.path[0], '..'))
|
|
|
|
import cimodel.lib.miniyaml as miniyaml
|
|
|
|
|
|
def regurgitate(depth, use_pyyaml_formatter=False):
|
|
data = yaml.safe_load(sys.stdin)
|
|
|
|
if use_pyyaml_formatter:
|
|
output = yaml.dump(data, sort_keys=True)
|
|
sys.stdout.write(output)
|
|
else:
|
|
miniyaml.render(sys.stdout, data, depth)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
regurgitate(3)
|