Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
change to friendly error message
Browse files Browse the repository at this point in the history
  • Loading branch information
yajiedesign committed Jul 1, 2018
1 parent 37c8165 commit 50e6b02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/mxnet/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ 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) or isinstance(buf, np.ndarray)):
raise ValueError('buf must bytes or numpy.ndarray,if you input str,please convert it to bytes')
buf = nd.array(np.frombuffer(buf, dtype=np.uint8), dtype=np.uint8)
return _internal._cvimdecode(buf, *args, **kwargs)

Expand Down

0 comments on commit 50e6b02

Please sign in to comment.