mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
With ufmt in place https://github.com/pytorch/pytorch/pull/81157, we can now use it to gradually format all files. I'm breaking this down into multiple smaller batches to avoid too many merge conflicts later on. This batch (as copied from the current BLACK linter config): * `tools/**/*.py` Upcoming batchs: * `torchgen/**/*.py` * `torch/package/**/*.py` * `torch/onnx/**/*.py` * `torch/_refs/**/*.py` * `torch/_prims/**/*.py` * `torch/_meta_registrations.py` * `torch/_decomp/**/*.py` * `test/onnx/**/*.py` Once they are all formatted, BLACK linter will be removed. Pull Request resolved: https://github.com/pytorch/pytorch/pull/81285 Approved by: https://github.com/suo
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import argparse
|
|
import sys
|
|
from os.path import abspath, dirname
|
|
|
|
# By appending pytorch_root to sys.path, this module can import other torch
|
|
# modules even when run as a standalone script. i.e., it's okay either you
|
|
# do `python build_libtorch.py` or `python -m tools.build_libtorch`.
|
|
pytorch_root = dirname(dirname(abspath(__file__)))
|
|
sys.path.append(pytorch_root)
|
|
|
|
from tools.build_pytorch_libs import build_caffe2
|
|
from tools.setup_helpers.cmake import CMake
|
|
|
|
if __name__ == "__main__":
|
|
# Placeholder for future interface. For now just gives a nice -h.
|
|
parser = argparse.ArgumentParser(description="Build libtorch")
|
|
parser.add_argument("--rerun-cmake", action="store_true", help="rerun cmake")
|
|
parser.add_argument(
|
|
"--cmake-only",
|
|
action="store_true",
|
|
help="Stop once cmake terminates. Leave users a chance to adjust build options",
|
|
)
|
|
options = parser.parse_args()
|
|
|
|
build_caffe2(
|
|
version=None,
|
|
cmake_python_library=None,
|
|
build_python=False,
|
|
rerun_cmake=options.rerun_cmake,
|
|
cmake_only=options.cmake_only,
|
|
cmake=CMake(),
|
|
)
|