"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "53869eb8cdc12ebedb020bf93c6bc0cc684bc7b2"
Unverified Commit 949f87cc authored by czkkkkkk's avatar czkkkkkk Committed by GitHub
Browse files

[FFI] Change enumeration name in DGLObjectTypeCode to avoid conflict with Pytorch (#4905)

parent c235d17d
...@@ -64,9 +64,9 @@ typedef enum { ...@@ -64,9 +64,9 @@ typedef enum {
* objects passed between C and Python. * objects passed between C and Python.
*/ */
typedef enum { typedef enum {
kInt = 0U, kObjectInt = 0U,
kUInt = 1U, kObjectUInt = 1U,
kFloat = 2U, kObjectFloat = 2U,
kHandle = 3U, kHandle = 3U,
kNull = 4U, kNull = 4U,
kDGLDataType = 5U, kDGLDataType = 5U,
......
...@@ -7,9 +7,9 @@ from libc.stdint cimport int32_t, int64_t, uint64_t, uint8_t, uint16_t ...@@ -7,9 +7,9 @@ from libc.stdint cimport int32_t, int64_t, uint64_t, uint8_t, uint16_t
import ctypes import ctypes
cdef enum DGLObjectTypeCode: cdef enum DGLObjectTypeCode:
kInt = 0 kObjectInt = 0
kUInt = 1 kObjectUInt = 1
kFloat = 2 kObjectFloat = 2
kHandle = 3 kHandle = 3
kNull = 4 kNull = 4
kDGLDataType = 5 kDGLDataType = 5
......
...@@ -94,10 +94,10 @@ cdef inline int make_arg(object arg, ...@@ -94,10 +94,10 @@ cdef inline int make_arg(object arg,
tcode[0] = arg.__class__._dgl_tcode tcode[0] = arg.__class__._dgl_tcode
elif isinstance(arg, (int, long)): elif isinstance(arg, (int, long)):
value[0].v_int64 = arg value[0].v_int64 = arg
tcode[0] = kInt tcode[0] = kObjectInt
elif isinstance(arg, float): elif isinstance(arg, float):
value[0].v_float64 = arg value[0].v_float64 = arg
tcode[0] = kFloat tcode[0] = kObjectFloat
elif isinstance(arg, str): elif isinstance(arg, str):
tstr = c_str(arg) tstr = c_str(arg)
value[0].v_str = tstr value[0].v_str = tstr
...@@ -108,7 +108,7 @@ cdef inline int make_arg(object arg, ...@@ -108,7 +108,7 @@ cdef inline int make_arg(object arg,
tcode[0] = kNull tcode[0] = kNull
elif isinstance(arg, Number): elif isinstance(arg, Number):
value[0].v_float64 = arg value[0].v_float64 = arg
tcode[0] = kFloat tcode[0] = kObjectFloat
elif isinstance(arg, CTypesDGLDataType): elif isinstance(arg, CTypesDGLDataType):
tstr = c_str(str(arg)) tstr = c_str(str(arg))
value[0].v_str = tstr value[0].v_str = tstr
...@@ -172,9 +172,9 @@ cdef inline object make_ret(DGLValue value, int tcode): ...@@ -172,9 +172,9 @@ cdef inline object make_ret(DGLValue value, int tcode):
return make_ret_object(value.v_handle) return make_ret_object(value.v_handle)
elif tcode == kNull: elif tcode == kNull:
return None return None
elif tcode == kInt: elif tcode == kObjectInt:
return value.v_int64 return value.v_int64
elif tcode == kFloat: elif tcode == kObjectFloat:
return value.v_float64 return value.v_float64
elif tcode == kNDArrayContainer: elif tcode == kNDArrayContainer:
return c_make_array(value.v_handle, False) return c_make_array(value.v_handle, False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment