wrapper dll works as I tried, but I had another personal problem so I give it up, (my another program is in WIN32 buy libtorch could only be in x64)  to use dll you need to creat a dll MSCV dll solution my cmakefile is like follow:
cmake_minimum_required(VERSION 3.19.1 FATAL_ERROR)
SET(LIBTrainer_SRC Trainer.cpp)
ADD_LIBRARY(Trainer SHARED ${LIBTrainer_SRC}) #SHARED for MSCV DLL solution
set(CMAKE_PREFIX_PATH “C:/Program Files/libtorch/share/cmake/Torch”)
find_package(Torch REQUIRED)
target_link_libraries(Trainer “${TORCH_LIBRARIES}”)
set_property(TARGET Trainer PROPERTY CXX_STANDARD 14)
if (MSVC)
file(GLOB TORCH_DLLS “${TORCH_INSTALL_PREFIX}/lib/*.dll”)
add_custom_command(TARGET Trainer
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${TORCH_DLLS}
$<TARGET_FILE_DIR:Trainer>)
endif (MSVC)
Then you can create a dll solution you can search for MSCV dll solution you for following