You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/24 23:15:32 UTC

[GitHub] piiswrong commented on a change in pull request #7585: Add string interface to updater to make it consistent with kvstore

piiswrong commented on a change in pull request #7585: Add string interface to updater to make it consistent with kvstore
URL: https://github.com/apache/incubator-mxnet/pull/7585#discussion_r135153490
 
 

 ##########
 File path: python/mxnet/kvstore.py
 ##########
 @@ -29,26 +29,37 @@
 from . import optimizer as opt
 
 def _ctype_key_value(keys, vals):
+    """
+    Returns ctype arrays for the key-value args, and the class of the key (either int or str).
+    For internal use only.
+    """
     if isinstance(keys, (tuple, list)):
         assert(len(keys) == len(vals))
         c_keys = []
         c_vals = []
+        key_type = None
         for key, val in zip(keys, vals):
-            c_key_i, c_val_i = _ctype_key_value(key, val)
+            c_key_i, c_val_i, t = _ctype_key_value(key, val)
             c_keys += c_key_i
             c_vals += c_val_i
-        return (c_array(ctypes.c_char_p, c_keys), c_array(NDArrayHandle, c_vals))
-    names = []
-    keys = str(keys)
+            key_type = t if key_type is None else key_type
+            assert(key_type == t), "inconsistent types of keys detected."
+        c_keys_arr = c_array(ctypes.c_char_p, c_keys) if key_type == str \
 
 Review comment:
   use base.string_types instead of str
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services