dalalaa
(dai)
1
I compiled the code following the instruction in docker. but got the following error while running python script.py
:
OSError: /home/huang/vsopencv/extension-script/example_app/build/warp_perspective/libwarp_perspective.so: undefined symbol: _ZN3c1017RegisterOperators25checkSchemaAndRegisterOp_ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEONS0_7OptionsE
I opened an issue in the repository issue#6, but got no answer.
Are you importing torch
before your extension?
This error is often seen, if you try to import the extension directly.
dalalaa
(dai)
3
Yes,I imported torch before loading extension,my code:
import torch
torch.ops.load_library("/home/example_app/build/warp_perspective/libwarp_perspective.so")
@torch.jit.script
def compute(x, y):
if bool(x[0][0] == 42):
z = 5
else:
z = 10
x = torch.ops.my_ops.warp_perspective(x, torch.eye(3))
return x.matmul(y) + z
print(compute.graph)
print(compute(torch.randn(4, 8), torch.randn(8, 5)))
compute.save("example.pt")
I got this error when running python script.py
:
(base) root@1b05a3dbfb17:/home# python script.py
Traceback (most recent call last):
File "script.py", line 3, in <module>
torch.ops.load_library("/home/example_app/build/warp_perspective/libwarp_perspective.so")
File "/root/local/miniconda/lib/python3.7/site-packages/torch/_ops.py", line 106, in load_library
ctypes.CDLL(path)
File "/root/local/miniconda/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/example_app/build/warp_perspective/libwarp_perspective.so: undefined symbol: _ZN3c104impl24ExcludeTensorTypeIdGuardD1Ev