SunDoge / tch-to-pytorch-poc

Repository from Github https://github.comSunDoge/tch-to-pytorch-pocRepository from Github https://github.comSunDoge/tch-to-pytorch-poc

tch to python poc

Environment

Check pytorch binary flag

python -c "import torch; print(torch._C._GLIBCXX_USE_CXX11_ABI)"

Set env. I'm using miniconda.

export LIBTORCH_CXX11_ABI=0 # based on previous result
export LIBTORCH=$HOME/miniconda3/envs/pt1.6/lib/python3.8/site-packages/torch
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH

Link the dynamic library

ln -s target/debug/libtch.so tch.so

Run

cargo build
python main.py

You'll see the eye generated by rust.

About


Languages

Language:Rust 95.6%Language:Python 4.4%