I tried to run a very simple example from the tvm tutorial which has been come in the following:
import tvm
import tvm.relay as relay
from tvm.relay.testing.mobilenet import get_workload as get_mobilenet
import numpy as np
expr , params = get_mobilenet()
ex = tvm.relay.create_executor("graph", mod=expr)
input = tvm.nd.array(np.random.rand(3,224,224).astype("float32"))
result = ex.evaluate(expr)(input, **params)
print(result)
But I got this error:
Traceback (most recent call last):
File "test.py", line 9, in <module>
result = ex.evaluate(expr)(input, **params)
File "/home/sara/tvm/python/tvm/relay/backend/interpreter.py", line 181, in evaluate
func = Function([], expr)
File "/home/sara/tvm/python/tvm/relay/function.py", line 54, in __init__
_ffi_api.Function, params, body, ret_type, type_params, attrs
File "/home/sara/tvm/python/tvm/_ffi/_ctypes/object.py", line 131, in __init_handle_by_constructor__
handle = __init_by_constructor__(fconstructor, args)
File "/home/sara/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 260, in __init_handle_by_constructor__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (3) /home/sara/tvm/build/libtvm.so(TVMFuncCall+0x5b) [0x7ff39ba39acb]
[bt] (2) /home/sara/tvm/build/libtvm.so(+0x1253441) [0x7ff39b948441]
[bt] (1) /home/sara/tvm/build/libtvm.so(tvm::RelayExpr tvm::runtime::TVMPODValue_::AsObjectRef<tvm::RelayExpr>() const+0x47f) [0x7ff39adeaf0f]
[bt] (0) /home/sara/tvm/build/libtvm.so(+0x6dcec2) [0x7ff39add1ec2]
File "/home/sara/tvm2/include/tvm/runtime/packed_func.h", line 687
TVMError: In function relay.ir.Function: error while converting argument 1: [14:57:33] /home/sara/tvm2/include/tvm/runtime/packed_func.h:1564:
---------------------------------------------------------------
An internal invariant was violated during the execution of TVM.
Please read TVM's error reporting guidelines.
More details can be found here: https://discuss.tvm.ai/t/error-reporting/7793.
---------------------------------------------------------------
Check failed: !checked_type.defined() == false: Expected RelayExpr, but got IRModule
Does anybody know where the error comes from?