This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/master by this push:
new f34e3a8 [RUNTIME][FFI] Fix cython FFI compact with np.int64 (#6321)
f34e3a8 is described below
commit f34e3a88a01a347e7cee02c7085b837baef1fb72
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Aug 22 08:30:48 2020 -0700
[RUNTIME][FFI] Fix cython FFI compact with np.int64 (#6321)
---
python/tvm/_ffi/_cython/packed_func.pxi | 2 +-
tests/python/unittest/test_runtime_packed_func.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/python/tvm/_ffi/_cython/packed_func.pxi
b/python/tvm/_ffi/_cython/packed_func.pxi
index 45bcf64..9f003a6 100644
--- a/python/tvm/_ffi/_cython/packed_func.pxi
+++ b/python/tvm/_ffi/_cython/packed_func.pxi
@@ -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):
diff --git a/tests/python/unittest/test_runtime_packed_func.py
b/tests/python/unittest/test_runtime_packed_func.py
index fcaceb3..aab84a1 100644
--- a/tests/python/unittest/test_runtime_packed_func.py
+++ b/tests/python/unittest/test_runtime_packed_func.py
@@ -296,11 +296,14 @@ def test_trace_can_change_traced_value_float():
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()