请问SDK部署优化后的模型推理如何编译代码?
您好,编译代码时,您需要链接libtorch相关库和SDK /usr/local/lib子目录下的SO文件(libtorch_blade.so和libral_base_context.so)。编译命令可以参照:TORCH_DIR=$(python3 -c 'import torch; import os; print(os.path.dirname(torch.file))')g++ torch_app.cc -std=c++14 \ -D_GLIBCXX_USE_CXX11_ABI=0 \ -I ${TORCH_DIR}/include \ -I ${TORCH_DIR}/include/torch/csrc/api/include \ -Wl,--no-as-needed \ -L /usr/local/lib \ -L ${TORCH_DIR}/lib \ -l torch -l torch_cuda -l torch_cpu -l c10 -l c10_cuda \ -l torch_blade -l ral_base_context \ -o torch_app
赞0
踩0