编译记录

git clone https://github.com/pytorch/pytorch
cd pytorch

python3 setup.py clean

mkdir build_libtorch
cd build_libtorch

export BUILD_CAFFE2_OPS=OFF
export USE_FBGEMM=OFF
export USE_FAKELOWP=OFF
export BUILD_TEST=OFF
export USE_MKLDNN=OFF
export USE_NNPACK=ON
export USE_XNNPACK=ON
export USE_QNNPACK=ON
export MAX_JOBS=4
export USE_OPENCV=OFF
export USE_NCCL=OFF
export USE_SYSTEM_NCCL=OFF
export BUILD_SHARED_LIBS=OFF
export PATH=/usr/lib/ccache:$PATH

python3 ../tools/build_libtorch.py



PYTORCH C++ API

libTorch 当前处于beta阶段,最稳定的PyTorch。

cppdocs

  • ATen: The foundational tensor and mathematical operation library on which all else is built. 张量与数学运算库
  • Autograd: Augments ATen with automatic differentiation. 自动标记,增强ATen
  • C++ Frontend: High level constructs for training and evaluation of machine learning models. 前端
  • TorchScript: An interface to the TorchScript JIT compiler and interpreter. TorchScript JIT编译器和解释器的接口
  • C++ Extensions: A means of extending the Python API with custom C++ and CUDA routines. 扩展