From 2112a1f9238438ce55af825a9b539eb12e4324f8 Mon Sep 17 00:00:00 2001
From: ziheng <ziheng@apache.org>
Date: Sun, 7 May 2017 18:24:41 -0700
Subject: [PATCH] [FIX] Miss kUInt in TypeCode2Str & dir method (#130)

* [FIX] Miss kUInt in TypeCode2Str & dir method

* [FIX] Add regression test
---
 include/tvm/runtime/packed_func.h        |  1 +
 python/tvm/_ffi/node.py                  |  2 +-
 tests/python/unittest/test_lang_basic.py | 11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/tvm/runtime/packed_func.h b/include/tvm/runtime/packed_func.h
index 4147f89d7..7f38581a4 100644
--- a/include/tvm/runtime/packed_func.h
+++ b/include/tvm/runtime/packed_func.h
@@ -521,6 +521,7 @@ class TVMRetValue : public TVMPODValue_ {
 inline const char* TypeCode2Str(int type_code) {
   switch (type_code) {
     case kInt: return "int";
+    case kUInt: return "uint";
     case kFloat: return "float";
     case kStr: return "str";
     case kBytes: return "bytes";
diff --git a/python/tvm/_ffi/node.py b/python/tvm/_ffi/node.py
index 23a74b4a8..97dc12d7a 100644
--- a/python/tvm/_ffi/node.py
+++ b/python/tvm/_ffi/node.py
@@ -6,7 +6,7 @@ import ctypes
 import sys
 from .. import _api_internal
 from .node_generic import NodeGeneric, convert_to_node, const
-from .base import _LIB, check_call, c_str, _FFI_MODE
+from .base import _LIB, check_call, c_str, py_str, _FFI_MODE
 
 IMPORT_EXCEPT = RuntimeError if _FFI_MODE == "cython" else ImportError
 try:
diff --git a/tests/python/unittest/test_lang_basic.py b/tests/python/unittest/test_lang_basic.py
index 63a109d3c..932c39553 100644
--- a/tests/python/unittest/test_lang_basic.py
+++ b/tests/python/unittest/test_lang_basic.py
@@ -71,6 +71,15 @@ def test_stmt():
                  tvm.stmt.For.Serial, 0,
                  x)
 
+def test_dir():
+    x = tvm.var('x')
+    dir(x)
+
+def test_dtype():
+    x = tvm.var('x')
+    assert x.dtype == 'int32'
+    y = tvm.var('y')
+    assert (x > y).dtype == 'uint1'
 
 if __name__ == "__main__":
     test_attr()
@@ -81,3 +90,5 @@ if __name__ == "__main__":
     test_basic()
     test_stmt()
     test_let()
+    test_dir()
+    test_dtype()
-- 
GitLab