ó R;]c@@s[dZddlmZddlmZmZddlZddlZddlZddl Z yddl Z Wne k r…dZ nXddl ZddlmZddlmZmZmZddlmZmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddlm Z dd lmZddlm!Z!ddlm"Z"ddl#m$Z%dedddgƒfd„ƒYZ&de'fd„ƒYZ(de'fd„ƒYZ)de)fd„ƒYZ*de)fd„ƒYZ+d„Z,d„Z-d „Z.d!e)fd"„ƒYZ/d#e)fd$„ƒYZ0d%„Z1d&„Z2e2ƒdS('s'Data iterators for common data formats.i(tabsolute_import(t OrderedDictt namedtupleNi(t_LIB(t c_str_arraytmx_uinttpy_str(tDataIterHandlet NDArrayHandle(t mx_real_t(t check_calltbuild_param_doc(tNDArray(t CSRNDArray(tarray(t _ndarray_cls(t concatenate(tarange(tshuffletDataDesctnametshapecB@sDeZdZedd„Zd„Zed„ƒZed„ƒZRS(s3DataDesc is used to store name, shape, type and layout information of the data or the label. The `layout` describes how the axes in `shape` should be interpreted, for example for image data setting `layout=NCHW` indicates that the first axis is number of examples in the batch(N), C is number of channels, H is the height and W is the width of the image. For sequential data, by default `layout` is set to ``NTC``, where N is number of examples in the batch, T the temporal axis representing time and C is the number of channels. Parameters ---------- cls : DataDesc The class. name : str Data name. shape : tuple of int Data shape. dtype : np.dtype, optional Data type. layout : str, optional Data layout. tNCHWcC@s4t|tƒj|||ƒ}||_||_|S(N(tsuperRt__new__tdtypetlayout(tclsRRRRtret((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRGs  cC@s d|j|j|j|jfS(NsDataDesc[%s,%s,%s,%s](RRRR(tself((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt__repr__MscC@s|dkrdS|jdƒS(sûGet the dimension that corresponds to the batch size. When data parallelism is used, the data will be automatically split and concatenated along the batch-size dimension. Axis can be -1, which means the whole array will be copied for each data-parallelism device. Parameters ---------- layout : str layout string. For example, "NCHW". Returns ------- int An axis indicating the batch_size dimension. itNN(tNonetfind(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytget_batch_axisQs cC@sw|dk rKt|ƒ}g|D](}t|d|d||dƒ^qSg|D]}t|d|dƒ^qRSdS(sªGet DataDesc list from attribute lists. Parameters ---------- shapes : a tuple of (name, shape) types : a tuple of (name, type) iiN(R tdictR(tshapesttypest type_dicttx((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytget_listgs  3( t__name__t __module__t__doc__R RRt staticmethodR"R((((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR-s  t DataBatchcB@s2eZdZddddddd„Zd„ZRS(sA data batch. MXNet's data iterator returns a batch of data for each `next` call. This data contains `batch_size` number of examples. If the input data consists of images, then shape of these images depend on the `layout` attribute of `DataDesc` object in `provide_data` parameter. If `layout` is set to 'NCHW' then, images should be stored in a 4-D matrix of shape ``(batch_size, num_channel, height, width)``. If `layout` is set to 'NHWC' then, images should be stored in a 4-D matrix of shape ``(batch_size, height, width, num_channel)``. The channels are often in RGB order. Parameters ---------- data : list of `NDArray`, each array containing `batch_size` examples. A list of input data. label : list of `NDArray`, each array often containing a 1-dimensional array. optional A list of input labels. pad : int, optional The number of examples padded at the end of a batch. It is used when the total number of examples read is not divisible by the `batch_size`. These extra padded examples are ignored in prediction. index : numpy.array, optional The example indices in this batch. bucket_key : int, optional The bucket key, used for bucketing module. provide_data : list of `DataDesc`, optional A list of `DataDesc` objects. `DataDesc` is used to store name, shape, type and layout information of the data. The *i*-th element describes the name and shape of ``data[i]``. provide_label : list of `DataDesc`, optional A list of `DataDesc` objects. `DataDesc` is used to store name, shape, type and layout information of the label. The *i*-th element describes the name and shape of ``label[i]``. cC@s£|dk r0t|ttfƒs0tdƒ‚n|dk r`t|ttfƒs`tdƒ‚n||_||_||_||_||_ ||_ ||_ dS(NsData must be list of NDArrayssLabel must be list of NDArrays( R t isinstancetlistttupletAssertionErrortdatatlabeltpadtindext bucket_keyt provide_datat provide_label(RR2R3R4R5R6R7R8((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt__init__œs $ $      cC@sig|jD]}|j^q }|jrJg|jD]}|j^q2}nd}dj|jj||ƒS(Ns${}: data shapes: {} label shapes: {}(R2RR3R tformatt __class__R)(Rtdt data_shapestlt label_shapes((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt__str__«s " N(R)R*R+R R9R@(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR-vs% tDataItercB@skeZdZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z RS( sÔThe base class for an MXNet data iterator. All I/O in MXNet is handled by specializations of this class. Data iterators in MXNet are similar to standard-iterators in Python. On each call to `next` they return a `DataBatch` which represents the next batch of data. When there is no more data to return, it raises a `StopIteration` exception. Parameters ---------- batch_size : int, optional The batch size, namely the number of items in the batch. See Also -------- NDArrayIter : Data-iterator for MXNet NDArray or numpy-ndarray objects. CSVIter : Data-iterator for csv data. LibSVMIter : Data-iterator for libsvm data. ImageIter : Data-iterator for images. icC@s ||_dS(N(t batch_size(RRB((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR9ÊscC@s|S(N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt__iter__ÍscC@sdS(s,Reset the iterator to the begin of the data.N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytresetÐsc C@sM|jƒrCtd|jƒd|jƒd|jƒd|jƒƒSt‚dS(sæGet next data batch from iterator. Returns ------- DataBatch The data of next batch. Raises ------ StopIteration If the end of the data is reached. R2R3R4R5N(t iter_nextR-tgetdatatgetlabeltgetpadtgetindext StopIteration(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytnextÔs cC@s |jƒS(N(RK(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt__next__çscC@sdS(s}Move to the next batch. Returns ------- boolean Whether the move is successful. N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyREêscC@sdS(s‡Get data of current batch. Returns ------- list of NDArray The data of the current batch. N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRFôscC@sdS(s�Get label of the current batch. Returns ------- list of NDArray The label of the current batch. N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRGþscC@sdS(sŸGet index of the current batch. Returns ------- index : numpy.array The indices of examples in the current batch. N(R (R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRIscC@sdS(s«Get the number of padding examples in the current batch. Returns ------- int Number of padding examples in the current batch. N((R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRHs( R)R*R+R9RCRDRKRLRERFRGRIRH(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRA¶s      t ResizeItercB@sPeZdZed„Zd„Zd„Zd„Zd„Zd„Z d„Z RS(sMResize a data iterator to a given number of batches. Parameters ---------- data_iter : DataIter The data iterator to be resized. size : int The number of batches per epoch to resize to. reset_internal : bool Whether to reset internal iterator on ResizeIter.reset. Examples -------- >>> nd_iter = mx.io.NDArrayIter(mx.nd.ones((100,10)), batch_size=25) >>> resize_iter = mx.io.ResizeIter(nd_iter, 2) >>> for batch in resize_iter: ... print(batch.data) [] [] cC@s†tt|ƒjƒ||_||_||_d|_d|_|j |_ |j |_ |j |_ t |dƒr‚|j |_ ndS(Nitdefault_bucket_key(RRMR9t data_itertsizetreset_internaltcurR t current_batchR7R8RBthasattrRN(RRORPRQ((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR92s        cC@s&d|_|jr"|jjƒndS(Ni(RRRQRORD(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRD@s  cC@sr|j|jkrtSy|jjƒ|_Wn0tk r^|jjƒ|jjƒ|_nX|jd7_tS(Ni( RRRPtFalseRORKRSRJRDtTrue(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyREEs  cC@s |jjS(N(RSR2(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRFQscC@s |jjS(N(RSR3(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRGTscC@s |jjS(N(RSR5(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRIWscC@s |jjS(N(RSR4(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRHZs( R)R*R+RVR9RDRERFRGRIRH(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRMs     tPrefetchingItercB@sƒeZdZd d d„Zd„Zed„ƒZed„ƒZd„Z d„Z d„Z d„Z d „Z d „Zd „ZRS( s€Performs pre-fetch for other data iterators. This iterator will create another thread to perform ``iter_next`` and then store the data in memory. It potentially accelerates the data read, at the cost of more memory usage. Parameters ---------- iters : DataIter or list of DataIter The data iterators to be pre-fetched. rename_data : None or list of dict The *i*-th element is a renaming map for the *i*-th iter, in the form of {'original_name' : 'new_name'}. Should have one entry for each entry in iter[i].provide_data. rename_label : None or list of dict Similar to ``rename_data``. Examples -------- >>> iter1 = mx.io.NDArrayIter({'data':mx.nd.ones((100,10))}, batch_size=25) >>> iter2 = mx.io.NDArrayIter({'data':mx.nd.ones((100,10))}, batch_size=25) >>> piter = mx.io.PrefetchingIter([iter1, iter2], ... rename_data=[{'data': 'data_1'}, {'data': 'data_2'}]) >>> print(piter.provide_data) [DataDesc[data_1,(25, 10L),,NCHW], DataDesc[data_2,(25, 10L),,NCHW]] cC@sÁtt|ƒjƒt|tƒs.|g}nt|ƒ|_|jdksRt‚||_||_ ||_ |j ddd|_ gt |jƒD]}tjƒ^q•|_gt |jƒD]}tjƒ^qÀ|_x|jD]}|jƒqåWt|_gt |jƒD] }d^q|_gt |jƒD] }d^q7|_d„}gt |jƒD]$}tjd|d||gƒ^qe|_x(|jD]}|jtƒ|jƒqœWdS(NiicS@s�x‰tr‹|j|jƒ|js'Pny|j|jƒ|j|>> data = np.arange(40).reshape((10,2,2)) >>> labels = np.ones([10, 1]) >>> dataiter = mx.io.NDArrayIter(data, labels, 3, True, last_batch_handle='discard') >>> for batch in dataiter: ... print batch.data[0].asnumpy() ... batch.data[0].shape ... [[[ 36. 37.] [ 38. 39.]] [[ 16. 17.] [ 18. 19.]] [[ 12. 13.] [ 14. 15.]]] (3L, 2L, 2L) [[[ 32. 33.] [ 34. 35.]] [[ 4. 5.] [ 6. 7.]] [[ 24. 25.] [ 26. 27.]]] (3L, 2L, 2L) [[[ 8. 9.] [ 10. 11.]] [[ 20. 21.] [ 22. 23.]] [[ 28. 29.] [ 30. 31.]]] (3L, 2L, 2L) >>> dataiter.provide_data # Returns a list of `DataDesc` [DataDesc[data,(3, 2L, 2L),,NCHW]] >>> dataiter.provide_label # Returns a list of `DataDesc` [DataDesc[softmax_label,(3, 1L),,NCHW]] In the above example, data is shuffled as `shuffle` parameter is set to `True` and remaining examples are discarded as `last_batch_handle` parameter is set to `discard`. Usage of `last_batch_handle` parameter: >>> dataiter = mx.io.NDArrayIter(data, labels, 3, True, last_batch_handle='pad') >>> batchidx = 0 >>> for batch in dataiter: ... batchidx += 1 ... >>> batchidx # Padding added after the examples read are over. So, 10/3+1 batches are created. 4 >>> dataiter = mx.io.NDArrayIter(data, labels, 3, True, last_batch_handle='discard') >>> batchidx = 0 >>> for batch in dataiter: ... batchidx += 1 ... >>> batchidx # Remaining examples are discarded. So, 10/3 batches are created. 3 `NDArrayIter` also supports multiple input and labels. >>> data = {'data1':np.zeros(shape=(10,2,2)), 'data2':np.zeros(shape=(20,2,2))} >>> label = {'label1':np.zeros(shape=(10,1)), 'label2':np.zeros(shape=(20,1))} >>> dataiter = mx.io.NDArrayIter(data, label, 3, True, last_batch_handle='discard') `NDArrayIter` also supports ``mx.nd.sparse.CSRNDArray`` with `last_batch_handle` set to `discard`. >>> csr_data = mx.nd.array(np.arange(40).reshape((10,4))).tostype('csr') >>> labels = np.ones([10, 1]) >>> dataiter = mx.io.NDArrayIter(csr_data, labels, 3, last_batch_handle='discard') >>> [batch.data[0] for batch in dataiter] [ , , ] Parameters ---------- data: array or list of array or dict of string to array The input data. label: array or list of array or dict of string to array, optional The input label. batch_size: int Batch size of data. shuffle: bool, optional Whether to shuffle the data. Only supported if no h5py.Dataset inputs are used. last_batch_handle : str, optional How to handle the last batch. This parameter can be 'pad', 'discard' or 'roll_over'. 'roll_over' is intended for training and can cause problems if used for prediction. data_name : str, optional The data name. label_name : str, optional The label name. iR4R2t softmax_labelc C@stt|ƒj|ƒt|dtd|ƒ|_t|dtd|ƒ|_t|jt ƒspt|jt ƒr‹|dkr‹t dƒ‚n|rt |jddj ddt jƒ}t|d|ƒjƒ|_t|j|jƒ|_t|j|jƒ|_n$t j |jddj dƒ|_|dkr{|jddj d|jddj d|} |j| |_ng|jD]} | d^q…g|jD]} | d^q¢|_t|jƒ|_|jj d|_|j|ksütd ƒ‚| |_||_||_dS( NR€R�tdiscardsU`NDArrayIter` only supports ``CSRNDArray`` with `last_batch_handle` set to `discard`.iiRtouts.batch_size needs to be smaller than data size.(RR‘R9R„RUR2RVR3RˆR tNotImplementedErrorRRRxtint32trandom_shuffleR�RŽR�t data_listRdt num_sourcetnum_dataR1tcursorRBtlast_batch_handle( RR2R3RBRRœt data_namet label_namettmp_idxtnew_nR'((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR9ƒs.$ '$ 2A   c C@sLg|jD]>\}}t|t|jgt|jdƒƒ|jƒ^q S(s5The name and shape of data provided by this iterator.i(R2RR0RBR/RR(RR‚Rƒ((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR7§sc C@sLg|jD]>\}}t|t|jgt|jdƒƒ|jƒ^q S(s6The name and shape of label provided by this iterator.i(R3RR0RBR/RR(RR‚Rƒ((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR8¯scC@s|j |_dS(s'Ignore roll over data and set to start.N(RBR›(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt hard_reset·scC@sW|jdkrF|j|jkrF|j |j|j|j|_n |j |_dS(Nt roll_over(RœR›RšRB(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRD»s!%cC@s"|j|j7_|j|jkS(N(R›RBRš(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyREÁsc C@sG|jƒr=td|jƒd|jƒd|jƒddƒSt‚dS(NR2R3R4R5(RER-RFRGRHR RJ(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRKÅs c C@s?|j|jkstdƒ‚|j|j|jkr g|D]Ë}t|dtjtfƒr~|d|j|j|j!nˆt|dt |j |j|j|j!ƒgt |j |j|j|j!ƒD]2}t |j |j|j|j!ƒj |ƒ^q̓^q>S|j|j|j}g|D] }t|dtjtfƒrrt |d|j|d| gƒnÂt t|dt |j |jƒgt |j |jƒD]%}t |j |jƒj |ƒ^qªƒt|dt |j | ƒgt |j | ƒD]"}t |j | ƒj |ƒ^qƒgƒ^q+SdS(s4Load data from underlying arrays, internal use only.sDataIter needs reset.iN(R›RšR1RBR.RxRyR RRRŽR/R5R(Rt data_sourceR'R`R4((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt_getdataÌs Ó cC@s|j|jƒS(N(R¤R2(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRFðscC@s|j|jƒS(N(R¤R3(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRGóscC@sE|jdkr=|j|j|jkr=|j|j|jSdSdS(NR4i(RœR›RBRš(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRHösN(R)R*R+R RUR9RvR7R8R¡RDRERKR¤RFRGRH(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR‘"s`  "     $  t MXDataItercB@sneZdZddd„Zd„Zd„Zd„Zd„Zd„Zd „Z d „Z d „Z d „Z RS( s¿A python wrapper a C++ data iterator. This iterator is the Python wrapper to all native C++ data iterators, such as `CSVIter`, `ImageRecordIter`, `MNISTIter`, etc. When initializing `CSVIter` for example, you will get an `MXDataIter` instance to use in your Python code. Calls to `next`, `reset`, etc will be delegated to the underlying C++ data iterators. Usually you don't need to interact with `MXDataIter` directly unless you are implementing your own data iterators in C++. To do that, please refer to examples under the `src/io` folder. Parameters ---------- handle : DataIterHandle, required The handle to the underlying C++ Data Iterator. data_name : str, optional Data name. Default to "data". label_name : str, optional Label name. Default to "softmax_label". See Also -------- src/io : The underlying C++ data iterator implementation, e.g., `CSVIter`. R2R’cK@s­tt|ƒjƒ||_t|_d|_|jƒ|_|jj d}|jj d}t ||j |j ƒg|_t ||j |j ƒg|_|j d|_dS(Ni(RR¥R9thandleRUt_debug_skip_loadR t first_batchRKR2R3RRRR7R8RB(RR¦R�RžR†R2R3((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR9s   cC@sttj|jƒƒdS(N(R RtMXDataIterFreeR¦(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRq)scC@st|_tjdƒdS(Ns>Set debug_skip_load to be true, will simply return first batch(RVR§tloggingtinfo(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytdebug_skip_load,s cC@s,t|_d|_ttj|jƒƒdS(N(RVt_debug_at_beginR R¨R RtMXDataIterBeforeFirstR¦(R((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRD3s  c C@sÿ|jrP|j rPtd|jƒgd|jƒgd|jƒd|jƒƒS|jdk ru|j}d|_|St |_t j dƒ}t t j|jt j|ƒƒƒ|jrõtd|jƒgd|jƒgd|jƒd|jƒƒSt‚dS(NR2R3R4R5i(R§R­R-RFRGRHRIR¨R RUtctypestc_intR RtMXDataIterNextR¦tbyreftvalueRJ(RRutnext_res((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRK8s0    " 0 cC@sK|jdk rtStjdƒ}ttj|jtj |ƒƒƒ|j S(Ni( R¨R RVR¯R°R RR±R¦R²R³(RR´((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyREIs "cC@s8tƒ}ttj|jtj|ƒƒƒt|tƒS(N( RR RtMXDataIterGetDataR¦R¯R²RRU(Rthdl((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRFPs "cC@s8tƒ}ttj|jtj|ƒƒƒt|tƒS(N( RR RtMXDataIterGetLabelR¦R¯R²RRU(RR¶((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRGUs "cC@s°tjdƒ}tjtjƒƒ}ttj|jtj|ƒtj|ƒƒƒ|jr¨tj |j ƒ}tj|jj |ƒ}t j |dt jƒ}|jƒSdSdS(NiR(R¯tc_uint64tPOINTERR RtMXDataIterGetIndexR¦R²R³t addressoftcontentst from_addressRxt frombuffertuint64tcopyR (Rt index_sizet index_datataddresstdbuffertnp_index((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRIZs   cC@s8tjdƒ}ttj|jtj|ƒƒƒ|jS(Ni(R¯R°R RtMXDataIterGetPadNumR¦R²R³(RR4((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyRHhs"( R)R*R+R9RqR¬RDRKRERFRGRIRH(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyR¥þs        c @s¡tjƒ}tjƒ}tƒ}tjtjƒƒ}tjtjƒƒ}tjtjƒƒ}ttjˆtj|ƒtj|ƒtj|ƒtj|ƒtj|ƒtj|ƒƒƒt|j ƒ‰t |j ƒ}t gt |ƒD]}t||ƒ^qégt |ƒD]}t||ƒ^qgt |ƒD]}t||ƒ^q5ƒ} d ddd} | |j | f} ‡‡fd†} ˆ| _ | | _| S( s Create an io iterator by handle.s%s s%s sReturns s------- s MXDataIter s The result iterator.c@sÊg}g}x:|jƒD],\}}|j|ƒ|jt|ƒƒqWt|ƒ}t|ƒ}tƒ}ttjˆtt |ƒƒ||t j |ƒƒƒt |ƒr½t dˆƒ‚nt ||�S(sECreate an iterator. The parameters listed below can be passed in as keyword arguments. Parameters ---------- name : string, required. Name of the resulting data iterator. Returns ------- dataiter: Dataiter The resulting data iterator. s$%s can only accept keyword arguments(R}R‰tstrRRR RtMXDataIterCreateIterRRdR¯R²R|R¥(Rctkwargst param_keyst param_valsR‚tvalt iter_handle(R¦t iter_name(sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytcreatorŒs       s%s %s s%s %s Returns (R¯tc_char_pRR¹R RtMXDataIterGetIterInfoR²RR³tintt_build_param_docRhR)R+( R¦Rtdesctnum_argst arg_namest arg_typest arg_descstnargR`t param_strtdoc_strRÏ((R¦RÎsH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt_make_io_iteratorms2       &&, #  cC@s¦tjtjƒƒ}tjƒ}ttjtj|ƒtj|ƒƒƒtj t }xIt |j ƒD]8}tj||ƒ}t |ƒ}t||j |ƒqfWdS(s6List and add all the data iterators to current module.N(R¯R¹tc_void_ptc_uintR RtMXListDataItersR²tsystmodulesR)RhR³RÜtsetattr(tplistRPt module_objR`R¶tdataiter((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pyt_init_io_module³s (  (3R+t __future__Rt collectionsRRRàR¯RªRiRwt ImportErrorR tnumpyRxtbaseRRRRRRR R R RÓRyR tndarray.sparseR RRŠRRRtndarray.randomRR—RtobjectR-RARMRWR„RˆR�R‘R¥RÜRæ(((sH/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/io.pytsJ       %I@fA�  Üo F