Skip to content

Commit

Permalink
[RUNTIME][FFI] Fix cython FFI compact with np.int64 (apache#6321)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored and Trevor Morris committed Aug 26, 2020
1 parent a0cdb57 commit d87c961
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/tvm/_ffi/_cython/packed_func.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ cdef inline int make_arg(object arg,
ptr = arg._tvm_handle
value[0].v_handle = (<void*>ptr)
tcode[0] = arg.__class__._tvm_tcode
elif isinstance(arg, (int, long)):
elif isinstance(arg, Integral):
value[0].v_int64 = arg
tcode[0] = kInt
elif isinstance(arg, float):
Expand Down
5 changes: 4 additions & 1 deletion tests/python/unittest/test_runtime_packed_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ def check_assign(dtype):
for t in ["float64", "float32"]:
check_assign(t)

def test_numpy_scalar():
maxint = (1<<63) - 1
assert tvm.testing.echo(np.int64(maxint)) == maxint


if __name__ == "__main__":
test_numpy_scalar()
test_rvalue_ref()
exit(0)
test_empty_array()
test_get_global()
test_get_callback_with_node()
Expand Down

0 comments on commit d87c961

Please sign in to comment.