Hi folks,
following the tutorial at 1, I am trying to implement a simple C++ torch script operator. I’ve installed libtorch 2 and managed to compile my module. However, when I am trying to load the operator via
import torch
torch.ops.load_library("/home/jviereck/dev/tools/torch_pinocchio/build/libtorch_pinocchio.so")
this is the error I am getting:
$ python2 ../test/basic.py
Traceback (most recent call last):
File "../test/basic.py", line 2, in <module>
torch.ops.load_library("/home/jviereck/dev/tools/torch_pinocchio/build/libtorch_pinocchio.so")
File "/home/jviereck/.local/lib/python2.7/site-packages/torch/_ops.py", line 102, in load_library
ctypes.CDLL(path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/jviereck/dev/tools/torch_pinocchio/build/libtorch_pinocchio.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_29E
Note that I’ve installed the torch via pip install torch
.
My best guess is that the python torch is not aware about the libraries in the libtorch folder. Does someone has an idea how to resolve this?
Best,
Julian