.. | ||
pytorch | ||
dune | ||
gen.ml | ||
gen.ml.1.9 | ||
gen.ml.1.10 | ||
gen.ml.1.11 | ||
gen.ml.2.0 | ||
gen.mli | ||
README.md |
Generate APIs
Get Declaration.yaml
file
# master branch can be replaced with release version. E.g., v1.7.0
git clone -b master --recurse-submodule https://github.com/pytorch/pytorch.git
mkdir pytorch-build
cd pytorch-build
cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch
cmake --build . --target install
The Declaration.yaml
file is artifact of building Libtorch from source. After running step 4 (can take a while - couple of hours)
cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch
.yaml file can be found in either: pytorch-install/share/ATEN/Declarations.yaml
or pytorch-build/aten/src/ATen/Declarations.yaml
Ref.
- https://github.com/pytorch/pytorch/blob/master/docs/libtorch.rst
- https://discuss.pytorch.org/t/compile-libtorch-c-api-from-source/81624
- https://github.com/pytorch/pytorch/issues/12562
Generate APIs
run from root folder (gotch
):
dune exec gen/gen.exe