Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/libtorch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Alternatively, you can invoke a shell script in the same directory to achieve the same goal
# 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 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

Expand Down