TVMError: Check failed: type_code_ == kDLInt (2 vs. 0) : expected int but get float


After I added a new OP in the project when I run the op test wrote by myself, the error comes out.
I double-checked the params, the data type is right, I don’t know why this error happens.

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (2) /usr/local/lib/python3.6/dist-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/ [0x7f93011591b5]
  [bt] (1) /usr/local/lib/python3.6/dist-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::runtime::TypedPackedFunc<tvm::relay::Expr (tvm::relay::Expr, tvm::relay::Expr, int, int, double, double)>::AssignTypedLambda<tvm::relay::Expr (*)(tvm::relay::Expr, tvm::relay::Expr, int, int, double, double)>(tvm::relay::Expr (*)(tvm::relay::Expr, tvm::relay::Expr, int, int, double, double))::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)+0xf4) [0x7f9300fd2174]
  [bt] (0) /usr/local/lib/python3.6/dist-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/ int() const+0x10e5) [0x7f9300a0ea25]
  File "/mnt/f/projects/wsl/tvm/include/tvm/runtime/packed_func.h", line 460
TVMError: Check failed: type_code_ == kDLInt (2 vs. 0) : expected int but get float


Looks like you passed in a float value into where we expect an integer


I defined my OP in fun(expr, expr, int, int, double, double), and I passed the params in with corresponding type and shape. Is there any hint for me how to debug it?


I haven’t add the schedule for my new topi op, may it be the root cause?


Ok, fixed it. Due to my WSL env.
After I move my code to real ubuntu env, it is ok now.


This is really interesting. Would you like to share some details why it doesn’t work in WSL? Thanks a lot!


Sorry for that. I am a beginner, I’m not familiar with TVM.
Could you give me some hints about how to add debug logs? Maybe this will help me.


Then printed lines are stack trace that would be useful for debugging :slight_smile:

You can gdb into these lines as well