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 {
* objects passed between C and Python.
*/
typedef enum {
kInt = 0U,
kUInt = 1U,
kFloat = 2U,
kObjectInt = 0U,
kObjectUInt = 1U,
kObjectFloat = 2U,
kHandle = 3U,
kNull = 4U,
kDGLDataType = 5U,
......
......@@ -7,9 +7,9 @@ from libc.stdint cimport int32_t, int64_t, uint64_t, uint8_t, uint16_t
import ctypes
cdef enum DGLObjectTypeCode:
kInt = 0
kUInt = 1
kFloat = 2
kObjectInt = 0
kObjectUInt = 1
kObjectFloat = 2
kHandle = 3
kNull = 4
kDGLDataType = 5
......
......@@ -94,10 +94,10 @@ cdef inline int make_arg(object arg,
tcode[0] = arg.__class__._dgl_tcode
elif isinstance(arg, (int, long)):
value[0].v_int64 = arg
tcode[0] = kInt
tcode[0] = kObjectInt
elif isinstance(arg, float):
value[0].v_float64 = arg
tcode[0] = kFloat
tcode[0] = kObjectFloat
elif isinstance(arg, str):
tstr = c_str(arg)
value[0].v_str = tstr
......@@ -108,7 +108,7 @@ cdef inline int make_arg(object arg,
tcode[0] = kNull
elif isinstance(arg, Number):
value[0].v_float64 = arg
tcode[0] = kFloat
tcode[0] = kObjectFloat
elif isinstance(arg, CTypesDGLDataType):
tstr = c_str(str(arg))
value[0].v_str = tstr
......@@ -172,9 +172,9 @@ cdef inline object make_ret(DGLValue value, int tcode):
return make_ret_object(value.v_handle)
elif tcode == kNull:
return None
elif tcode == kInt:
elif tcode == kObjectInt:
return value.v_int64
elif tcode == kFloat:
elif tcode == kObjectFloat:
return value.v_float64
elif tcode == kNDArrayContainer:
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