topi/python/topi/cpp/__init__.py
was added on Nov 15
https://github.com/apache/incubator-tvm/commits/master/topi/python/topi/cpp
topi/python/topi/cpp/__init__.py
was added on Nov 15
https://github.com/apache/incubator-tvm/commits/master/topi/python/topi/cpp
@tqchen @vinx13 After topi/python/topi/cpp/__init__.py
was added to the code import topi
needs libtvm_topi.so
but for some reason it only looks to tvm installation folder to find the libs but not to topi installation folder.
libtvm_topi.so
to tvm installation folderI didn’t quite get it. libtvm_topi.so
should have libtvm.so
as a dependency right? Does it mean libtvm_topi.so
is not inside the same folder as libtvm.so
?
What should I finally do to fix the import error? my tvm/build directory already contains libtvm_topi.so and " export LD_LIBRARY_PATH=/usr/local/lib/python3.6/dist-packages/topi-0.6.dev0-py3.6.egg/topi " or " export LD_LIBRARY_PATH=/home/jetbot/.local/lib/python3.6/site-packages/topi-0.6.dev0-py3.6.egg/topi " is not working. I am getting the same error as before. Help would be much appreciated!
@were @junrushao @tqchen I think the issue was introduced by PR 4275 17 days ago. This PR adds topi/python/topi/cpp/__init__.py
.
If you install tvm
, nnvm
and topi
packages using sudo python3 setup.py install
and if you do NOT set LD_LIBRARY_PATH
then from tvm import relay
fails
Traceback (most recent call last):
File "./compile.py", line 84, in <module>
from tvm import relay
File "/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/relay/__init__.py", line 27, in <module>
from . import expr_functor
File "/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/relay/expr_functor.py", line 24, in <module>
from .op import Op
File "/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/relay/op/__init__.py", line 20, in <module>
from .op import get, register, register_schedule, register_compute, register_gradient, \
File "/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/relay/op/op.py", line 19, in <module>
import topi
File "/usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/__init__.py", line 43, in <module>
from . import nn
File "/usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/nn/__init__.py", line 23, in <module>
from .deformable_conv2d import *
File "/usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/nn/deformable_conv2d.py", line 23, in <module>
from ..cpp.image import bilinear_sample_nchw
ImportError: cannot import name 'bilinear_sample_nchw'
Interesting. I will start a docker image and look into this issue
@apivovarov Yes, I am able to reproduce this case.
If we print _LIB, _LIB_NAME
in topi/python/topi/cpp/impl.py
, then you will see None
in this case, which means the system is unable to find libtvm_topi.so
.
Hmmm, this is not relevant to PR 4275, but it does reveal some underlying issues.
If you remove the optional
in this line, TOPI will print all search paths:
/usr/local/sbin/libtvm_topi.so
/usr/local/bin/libtvm_topi.so
/usr/sbin/libtvm_topi.so
/usr/bin/libtvm_topi.so
/sbin/libtvm_topi.so
/bin/libtvm_topi.so
/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/libtvm_topi.so
/usr/local/lib/python3.6/dist-packages/build/libtvm_topi.so
/usr/local/lib/python3.6/dist-packages/build/Release/libtvm_topi.so
/usr/local/lib/python3.6/dist-packages/lib/libtvm_topi.so
/usr/local/lib/python3.6/libtvm_topi.so
/usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/cpp/libtvm_topi.so
/usr/local/sbin/tvm_topi.so
/usr/local/bin/tvm_topi.so
/usr/sbin/tvm_topi.so
/usr/bin/tvm_topi.so
/sbin/tvm_topi.so
/bin/tvm_topi.so
/usr/local/lib/python3.6/dist-packages/tvm-0.6.0-py3.6-linux-x86_64.egg/tvm/tvm_topi.so
/usr/local/lib/python3.6/dist-packages/build/tvm_topi.so
/usr/local/lib/python3.6/dist-packages/build/Release/tvm_topi.so
/usr/local/lib/python3.6/dist-packages/lib/tvm_topi.so
/usr/local/lib/python3.6/tvm_topi.so
/usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/cpp/tvm_topi.so
Yes, this doesn’t include /usr/local/lib/python3.6/dist-packages/topi-0.6.0-py3.6.egg/topi/libtvm_topi.so
This file was renamed from topi/cpp.py
to topi/cpp/impl.py.
The logic to find libtvm_topi.so
uses relative path. After cpp.py
was moved under cpp
subfolder it can not find libtvm_topi.so
anymore. So, the bug was introduced in PR 4275. Thank you for the fix
Thank you for reporting this!