libtorch

Libtorch on Raspberry can't load pt file but working on ubuntu

好久不见. 提交于 2020-07-09 17:13:07
问题 I'm trying to build a C++ program with libtorch on a Raspberry PI. The program is working on Ubuntu, but I've got the following error at build on Raspberry : error: use of deleted function ‘void torch::jit::script::Module::operator=(const torch::jit::script::Module&)’ In file included from /usr/include/torch/csrc/jit/ir.h:18, from /usr/include/torch/csrc/jit/tracer.h:9, from /usr/include/torch/csrc/autograd/generated/variable_factories.h:8, from /usr/include/torch/csrc/api/include/torch

Libtorch on Raspberry can't load pt file but working on ubuntu

烂漫一生 提交于 2020-07-09 17:10:28
问题 I'm trying to build a C++ program with libtorch on a Raspberry PI. The program is working on Ubuntu, but I've got the following error at build on Raspberry : error: use of deleted function ‘void torch::jit::script::Module::operator=(const torch::jit::script::Module&)’ In file included from /usr/include/torch/csrc/jit/ir.h:18, from /usr/include/torch/csrc/jit/tracer.h:9, from /usr/include/torch/csrc/autograd/generated/variable_factories.h:8, from /usr/include/torch/csrc/api/include/torch

Libtorch/Pytorch Dilemma when combined static library into one STATIC library

六月ゝ 毕业季﹏ 提交于 2019-12-23 05:16:01
问题 I have around 26 static libraries such as liba.a, libb.a, libc.a, ..., libz.a . There are two catches here: 1) circular dependencies between for example liba.a and libb.a ; 2) some lib*.a has static global registration code which is unreferenced, but shall NOT be stripped away. Thanks to stackoverflow, I managed to solve above two problems with the ld option -Wl,--whole-archive -la -lb -lc -ld -le ...(omitted)... -lz -Wl,--no-whole-archive -lpthread -lm -ldl -lrt -fopenmp , and the executable

LibTorch with CMake via Eclipse in Windows:Terminated exit value 390

江枫思渺然 提交于 2019-12-13 04:18:29
问题 I used cmake4eclipse to build torch C++ version 1.0 stable in Windows 10. Basically, I have the following CMakeLists.txt to build the mnist example: cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(mnist) set(CMAKE_PREFIX_PATH "C:/rl/libtorch/share/cmake/Torch") set(Torch_DIR "C:/rl/libtorch") find_package(Torch REQUIRED) option(DOWNLOAD_MNIST "Download the MNIST dataset from the internet" ON) if (DOWNLOAD_MNIST) message(STATUS "Downloading MNIST dataset") execute_process( COMMAND

libtorch convert ModuleDict into C++

南笙酒味 提交于 2019-12-11 19:09:41
问题 Does anyone know how to convert a pytorch model (with ModuleDict member variable) into C++ through libtorch tracing? The main problem is that its forward function accept only ONE channel_tensor . To make the whole C++ model to work, we need to trace the model with ALL possible channel_tensor . I can trace one channel with id = 1 like below, but how shall we combine together traced model for channel_id = 2, 3, 4, 5? channel = torch.ones(1, dtype=torch.int64) traced_script_module = torch.jit

Libtorch/Pytorch Dilemma when combined static library into one STATIC library

房东的猫 提交于 2019-12-04 21:19:27
I have around 26 static libraries such as liba.a, libb.a, libc.a, ..., libz.a . There are two catches here: 1) circular dependencies between for example liba.a and libb.a ; 2) some lib*.a has static global registration code which is unreferenced, but shall NOT be stripped away. Thanks to stackoverflow, I managed to solve above two problems with the ld option -Wl,--whole-archive -la -lb -lc -ld -le ...(omitted)... -lz -Wl,--no-whole-archive -lpthread -lm -ldl -lrt -fopenmp , and the executable binary works! It is also explained in ld linker question: the --whole-archive option Now I need to