Update libtorch docs (#21150)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/20271
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21150

Differential Revision: D15559590

Pulled By: pjh5

fbshipit-source-id: 4063bf91464425e8efe4765dc17bb7e9b7bfccc7
This commit is contained in:
Jesse Hellemn
2019-05-30 12:38:36 -07:00
committed by Facebook Github Bot
parent 313ef4f5d5
commit 4aee92833c

View File

@ -11,14 +11,21 @@ Building libtorch
You can use a python script/module located in tools package to build libtorch
::
cd <pytorch_root>
# export some required environment variables
python -m tools.build_libtorch
# Make a new folder to build in to avoid polluting the source directories
mkdir build_libtorch && cd build_libtorch
# You might need to export some required environment variables here.
Normally setup.py sets good default env variables, but you'll have to do
that manually.
python ../tools/build_libtorch.py
Alternatively, you can invoke a shell script in the same directory to achieve the same goal
Alternatively, you can call setup.py normally and then copy the built cpp libraries. This method may have side effects to your active Python installation.
::
cd <pytorch_root>
ONNX_NAMESPACE=onnx_torch bash tools/build_pytorch_libs.sh --use-nnpack caffe2
python setup.py build
ls torch/lib/tmp_install # output is produced here
ls torch/lib/tmp_install/lib/libtorch.so # of particular interest