# Could TVM support function with int8, uint8, int16, or uint16 inputs?

**URL:** <https://discuss.tvm.apache.org/t/could-tvm-support-function-with-int8-uint8-int16-or-uint16-inputs/8839>\
**Category:** Questions\
**Created:** [January 12, 2021, 9:04am UTC](https://discuss.tvm.apache.org/t/could-tvm-support-function-with-int8-uint8-int16-or-uint16-inputs/8839 "2021-01-12T09:04:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallcoscat](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/s/eb8c5e/32.png) [@smallcoscat](https://discuss.tvm.apache.org/u/smallcoscat)\
**Post date:** [January 12, 2021, 9:04am UTC](https://discuss.tvm.apache.org/t/could-tvm-support-function-with-int8-uint8-int16-or-uint16-inputs/8839/1 "2021-01-12T09:04:05Z")

</div>

I tried to modify the file, “pack\_args.h”, to run the kernel function with int8, uint8, int16, or uint16 input. The following is a part of code.

> enum ArgConvertCode { INT64\_TO\_INT64, INT64\_TO\_INT32, INT64\_TO\_UINT32, FLOAT64\_TO\_FLOAT32, FLOAT64\_TO\_FLOAT64, HANDLE\_TO\_HANDLE, INT64\_TO\_INT8, INT64\_TO\_UINT8, INT64\_TO\_INT16, INT64\_TO\_UINT16 };

> inline ArgConvertCode GetArgConvertCode(DLDataType t) { CHECK\_EQ(t.lanes, 1U) \<\< “Cannot pass vector type argument to devic function for now”; if (t.code == kDLInt) { if (t.bits == 64U) return INT64\_TO\_INT64; if (t.bits == 32U) return INT64\_TO\_INT32; if (t.bits == 8U) return INT64\_TO\_INT8; if (t.bits == 16U) return INT64\_TO\_INT16; } else if (t.code == kDLUInt) { if (t.bits == 32U) return INT64\_TO\_UINT32; if (t.bits == 8U) return INT64\_TO\_UINT8; if (t.bits == 16U) return INT64\_TO\_UINT16; } else if (t.code == kDLFloat) { if (t.bits == 64U) return FLOAT64\_TO\_FLOAT64; if (t.bits == 32U) return FLOAT64\_TO\_FLOAT32; } else if (t.code == kTVMOpaqueHandle) { return HANDLE\_TO\_HANDLE; } LOG(FATAL) \<\< “Cannot handle " \<\< t \<\< " as device function argument”; return HANDLE\_TO\_HANDLE; }

But I got the error as below:

> TVMError: Check failed: ret == 0 (-1 vs. 0) : Check failed: i \< num\_args (1 vs. 1) : not enough argument passed, 1 passed but request arg[1].

I traced this error. it seems the argument lose when call PackedFunc().

> class PackedFunc { template \<typename… Args\> inline TVMRetValue operator()(Args&&… args) const;

Could you help me solve this problem?

---

<div class="post-metadata">

**Author:** ![SYangDong](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/syangdong/32/1679_2.png) [@SYangDong](https://discuss.tvm.apache.org/u/SYangDong)\
**Post date:** [January 14, 2021, 9:50am UTC](https://discuss.tvm.apache.org/t/could-tvm-support-function-with-int8-uint8-int16-or-uint16-inputs/8839/2 "2021-01-14T09:50:49Z")

</div>

TVM do support function with int8, int16, or uint16 inputs. The problem you mentioned above might be the runtime error. " not enough argument passed," I guess. You need to check your python code, which means the data you passed in should match you device data format and input arguments.

---

<div class="post-metadata">

**Author:** ![smallcoscat](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/s/eb8c5e/32.png) [@smallcoscat](https://discuss.tvm.apache.org/u/smallcoscat)\
**Post date:** [January 15, 2021, 8:02am UTC](https://discuss.tvm.apache.org/t/could-tvm-support-function-with-int8-uint8-int16-or-uint16-inputs/8839/3 "2021-01-15T08:02:51Z")

</div>

I mean the input of the partition function, not the model.
