Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] concat([x], axis=1) return random results #11895

Closed
ganler opened this issue Jun 24, 2022 · 7 comments · Fixed by #11907
Closed

[Bug] concat([x], axis=1) return random results #11895

ganler opened this issue Jun 24, 2022 · 7 comments · Fixed by #11907

Comments

@ganler
Copy link
Contributor

ganler commented Jun 24, 2022

import tvm
from tvm import relay
import numpy as np

x1_shape = (2, 1)

x1 = relay.var("x1", shape=x1_shape, dtype='int64')
concatenate = relay.op.concatenate([x1], axis=1)

f = relay.Function([x1], concatenate)

x1_val = np.array([[6], [5]], dtype='int64')

op_res = relay.create_executor('graph', device=tvm.cpu(), target='llvm').evaluate(f)(x1_val)
print(op_res)
print(f'should be equal to {x1_val}')

Expected behavior

op_res should be same as [[6], [5]].

Actual behavior

1st try:

image

2nd try:

image

3rd try:

image

Environment

ed638ef on Ubuntu 20.04.

cc: @masahi

@lileidev
Copy link

I tried the sample code to reproduce, but get bellow error:
Traceback (most recent call last):
File "5.py", line 1, in
import tvm
File "/home/larry/.wine/drive_d/tvm/python/tvm/init.py", line 42, in
from .ir import IRModule
File "/home/larry/.wine/drive_d/tvm/python/tvm/ir/init.py", line 33, in
from .memory_pools import (
File "/home/larry/.wine/drive_d/tvm/python/tvm/ir/memory_pools.py", line 38, in
class PoolInfoProperties(Object):
File "/home/larry/.wine/drive_d/tvm/python/tvm/_ffi/registry.py", line 69, in register
check_call(_LIB.TVMObjectTypeKey2Index(c_str(object_name), ctypes.byref(tidx)))
File "/home/larry/.wine/drive_d/tvm/python/tvm/_ffi/base.py", line 348, in check_call
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
81: 0xffffffffffffffff
80: _start
79: __libc_start_main
at ../csu/libc-start.c:308
78: Py_BytesMain
77: Py_RunMain
76: PyRun_SimpleFileExFlags
75: 0x000000000067e470
74: 0x000000000067e3ce
73: 0x000000000067e350
72: PyEval_EvalCode
71: _PyEval_EvalCodeWithName
70: _PyEval_EvalFrameDefault
69: PyImport_ImportModuleLevelObject
68: _PyObject_CallMethodIdObjArgs
67: 0x00000000005f4400
66: _PyFunction_Vectorcall
65: _PyEval_EvalFrameDefault
64: _PyFunction_Vectorcall
63: _PyEval_EvalFrameDefault
62: _PyFunction_Vectorcall
61: _PyEval_EvalFrameDefault
60: _PyFunction_Vectorcall
59: _PyEval_EvalFrameDefault
58: _PyFunction_Vectorcall
57: _PyEval_EvalCodeWithName
56: _PyEval_EvalFrameDefault
55: PyVectorcall_Call
54: 0x00000000005c4a3f
53: 0x00000000006003a3
52: PyEval_EvalCode
51: _PyEval_EvalCodeWithName
50: _PyEval_EvalFrameDefault
49: PyImport_ImportModuleLevelObject
48: _PyObject_CallMethodIdObjArgs
47: 0x00000000005f4400
46: _PyFunction_Vectorcall
45: _PyEval_EvalFrameDefault
44: _PyFunction_Vectorcall
43: _PyEval_EvalFrameDefault
42: _PyFunction_Vectorcall
41: _PyEval_EvalFrameDefault
40: _PyFunction_Vectorcall
39: _PyEval_EvalFrameDefault
38: _PyFunction_Vectorcall
37: _PyEval_EvalCodeWithName
36: _PyEval_EvalFrameDefault
35: PyVectorcall_Call
34: 0x00000000005c4a3f
33: 0x00000000006003a3
32: PyEval_EvalCode
31: _PyEval_EvalCodeWithName
30: _PyEval_EvalFrameDefault
29: PyImport_ImportModuleLevelObject
28: _PyObject_CallMethodIdObjArgs
27: 0x00000000005f4400
26: _PyFunction_Vectorcall
25: _PyEval_EvalFrameDefault
24: _PyFunction_Vectorcall
23: _PyEval_EvalFrameDefault
22: _PyFunction_Vectorcall
21: _PyEval_EvalFrameDefault
20: _PyFunction_Vectorcall
19: _PyEval_EvalFrameDefault
18: _PyFunction_Vectorcall
17: _PyEval_EvalCodeWithName
16: _PyEval_EvalFrameDefault
15: PyVectorcall_Call
14: 0x00000000005c4a3f
13: 0x00000000006003a3
12: PyEval_EvalCode
11: _PyEval_EvalCodeWithName
10: _PyEval_EvalFrameDefault
9: _PyFunction_Vectorcall
8: _PyEval_EvalCodeWithName
7: _PyEval_EvalFrameDefault
6: _PyObject_MakeTpCall
5: 0x00007fb5add2a9db
4: _ctypes_callproc
3: 0x00007fb5aeaba409
2: 0x00007fb5aeabaff4
1: TVMObjectTypeKey2Index
0: tvm::runtime::Object::TypeKey2Index(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
File "/home/larry/.wine/drive_d/tvm/src/runtime/object.cc", line 165
TVMError:

An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html

Check failed: (it != type_key2index_.end()) is false: Cannot find type ir.PoolInfoProperties. Did you forget to register the node by TVM_REGISTER_NODE_TYPE ?

@ganler
Copy link
Contributor Author

ganler commented Jun 25, 2022

I doubled checked that but I can still reproduce it (in the commit version I attached which is very recent). I think the operators used here are very common that it is not likely to be not registering them. You can try more recent TVM if you want to reproduce it.

@masahi
Copy link
Member

masahi commented Jun 25, 2022

what happens if you revert the commits #11341 and #11800?

@ganler
Copy link
Contributor Author

ganler commented Jun 25, 2022

Just tried the commit right before #11800, this issue is still there. am trying #11341 ~1 now.

@ganler
Copy link
Contributor Author

ganler commented Jun 25, 2022

@masahi So a1d95ec (#11341 ~1) is correct as follows:

image

I also directly tried #11341 it fails:

image

Therefore, it is highly likely that this bug is introduced by #11341.

cc: @shtinsa

@masahi
Copy link
Member

masahi commented Jun 27, 2022

@shtinsa Can you take a look?

@shtinsa
Copy link
Contributor

shtinsa commented Jun 27, 2022

Hello, the fix is in this PR: #11907

@masahi masahi linked a pull request Jun 27, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants