[FFmpeg-devel] [PATCH v4] libavfi/dnn: add LibTorch as one of DNN backend
Cosmin Stejerean
cosmin at cosmin.at
Thu Feb 29 23:25:51 EET 2024
> On Feb 20, 2024, at 7:07 PM, wenbin.chen-at-intel.com at ffmpeg.org wrote:
>
> From: Wenbin Chen <wenbin.chen at intel.com>
>
> PyTorch is an open source machine learning framework that accelerates
> the path from research prototyping to production deployment. Official
> website: https://pytorch.org/. We call the C++ library of PyTorch as
> LibTorch, the same below.
>
> To build FFmpeg with LibTorch, please take following steps as reference:
> 1. download LibTorch C++ library in https://pytorch.org/get-started/locally/,
> please select C++/Java for language, and other options as your need.
I tested this locally with the current release (2.2.1) and this should clarify that the cxx11 ABI version needs to be downloaded (libtorch-cxx11-abi-shared-with-deps-*.zip) otherwise it fails to link with undefined reference to various c10 components.
>
> @@ -6886,6 +6888,7 @@ enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Versi
> enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
> enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
> enabled libtls && require_pkg_config libtls libtls tls.h tls_configure
> +enabled libtorch && check_cxxflags -std=c++14 && require_cpp libtorch torch/torch.h "torch::Tensor" -ltorch -lc10 -ltorch_cpu -lstdc++ -lpthread
This needs to be c++17 at least for the most recent (2.2.1) release. It fails to compile with c++14.
- Cosmin
More information about the ffmpeg-devel
mailing list