You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/09/14 08:16:20 UTC

[GitHub] lupesko commented on a change in pull request #10697: [MXNET-360]auto convert str to bytes in img.imdecode when py3

lupesko commented on a change in pull request #10697: [MXNET-360]auto convert str to bytes in img.imdecode when py3
URL: https://github.com/apache/incubator-mxnet/pull/10697#discussion_r217633590
 
 

 ##########
 File path: python/mxnet/image/image.py
 ##########
 @@ -133,6 +135,9 @@ def imdecode(buf, *args, **kwargs):
     <NDArray 224x224x3 @cpu(0)>
     """
     if not isinstance(buf, nd.NDArray):
+        if sys.version_info[0] == 3 and not isinstance(buf, (bytes, np.ndarray)):
+            raise ValueError('buf must bytes or numpy.ndarray,'
+                             'if you input str,please convert it to bytes')
 
 Review comment:
   nit: suggest rephrase: "if you would like to input type str, please convert to bytes"

----------------------------------------------------------------
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