C++ undefined references

I am trying to integrate PyTorch into an existing project. I needed to rename the package to avoid a clash with Torch 7. (I know…)

I am getting confused by three undefined references. I have gone so far as to manually reference all of the .so files by absolute path in cmake and have confirmed that one of them contains the first undefined reference using nm, but my linker still gives me undefined references to:

`torch::jit::load(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’

`c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’

`c10::Symbol::fromQualString(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’

Does anybody have any suggestions? Converting the existing Torch 7 models to Pytorch is sadly non-trivial, and I’m not sure that’s even the cause.

(I do of course get even more torch-related undefined references if I don’t link manually to the .so files so that’s working)

Hi,

I’m not sure about the undefined reference, but to convert an old Torch7 model that you saved, you can just do torch.load_lua("your_file.t7") to load it as a pytorch nn.Module.