pytorch/tools/build_libtorch.py
Bugra Akyildiz cff0e57c31 Remove Incorrect Comment in tools/build_libtorch and remove Python2 support in the module import (#44888)
Summary:
Fixes #{44293} and removes Python2 imports from MNIST download module as Python2 is not being supported.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/44888

Reviewed By: agolynski

Differential Revision: D23785579

Pulled By: bugra

fbshipit-source-id: d9380502380876282008dd2d5feb92a446648982
2020-09-18 10:03:36 -07:00

21 lines
807 B
Python

import argparse
from os.path import dirname, abspath
import sys
# 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')
options = parser.parse_args()
build_caffe2(version=None, cmake_python_library=None, build_python=False,
rerun_cmake=True, cmake_only=False, cmake=CMake())