You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/08/24 23:22:28 UTC
[incubator-mxnet] branch master updated: make MXDataIter work
without indices (#7456)
This is an automated email from the ASF dual-hosted git repository.
jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 4b94360 make MXDataIter work without indices (#7456)
4b94360 is described below
commit 4b94360e6e970ea71252f1e79b841e7bc4105de5
Author: Saswata <sa...@gmail.com>
AuthorDate: Thu Aug 24 19:22:25 2017 -0400
make MXDataIter work without indices (#7456)
indices are optional, custom cpp iterators providing data batches
without indices should work while using MXDataIter.
---
python/mxnet/io.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/python/mxnet/io.py b/python/mxnet/io.py
index 4e69a8a..314a2b2 100644
--- a/python/mxnet/io.py
+++ b/python/mxnet/io.py
@@ -815,10 +815,13 @@ class MXDataIter(DataIter):
check_call(_LIB.MXDataIterGetIndex(self.handle,
ctypes.byref(index_data),
ctypes.byref(index_size)))
- address = ctypes.addressof(index_data.contents)
- dbuffer = (ctypes.c_uint64* index_size.value).from_address(address)
- np_index = np.frombuffer(dbuffer, dtype=np.uint64)
- return np_index.copy()
+ if index_size.value:
+ address = ctypes.addressof(index_data.contents)
+ dbuffer = (ctypes.c_uint64* index_size.value).from_address(address)
+ np_index = np.frombuffer(dbuffer, dtype=np.uint64)
+ return np_index.copy()
+ else:
+ return None
def getpad(self):
pad = ctypes.c_int(0)
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].