ó šÄïYc@sndZddlZddlmZmZdefd„ƒYZdefd„ƒYZd efd „ƒYZdS( sDataset container.iÿÿÿÿNi(trecordiotndarraytDatasetcBs eZdZd„Zd„ZRS(sAbstract dataset class. All datasets should have this interface. Subclasses need to override `__getitem__`, which returns the i-th element, and `__len__`, which returns the total number elements. .. note:: An mxnet or numpy array can be directly used as a dataset. cCs t‚dS(N(tNotImplementedError(tselftidx((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyt __getitem__!scCs t‚dS(N(R(R((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyt__len__$s(t__name__t __module__t__doc__RR(((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyRs t ArrayDatasetcBs)eZdZd„Zd„Zd„ZRS(s'A dataset with a data array and a label array. The i-th sample is `(data[i], lable[i])`. Parameters ---------- data : array-like object The data array. Can be mxnet or numpy array. label : array-like object The label array. Can be mxnet or numpy array. cCsmt|ƒt|ƒkst‚||_t|tjƒr`t|jƒdkr`|jƒ|_n ||_dS(Ni( tlentAssertionErrort_datat isinstanceRtNDArraytshapetasnumpyt_label(Rtdatatlabel((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyt__init__4s  'cCs|j||j|fS(N(RR(RR((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyR<scCs t|jƒS(N(R R(R((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyR?s(RR R RRR(((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyR (s   tRecordFileDatasetcBs)eZdZd„Zd„Zd„ZRS(sÈA dataset wrapping over a RecordIO (.rec) file. Each sample is a string representing the raw content of an record. Parameters ---------- filename : str Path to rec file. cCs6tjj|ƒdd}tj||dƒ|_dS(Nis.idxtr(tostpathtsplitextRtMXIndexedRecordIOt_record(Rtfilenametidx_file((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyRMscCs|jj|ƒS(N(Rtread_idx(RR((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyRQscCst|jjƒS(N(R Rtkeys(R((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyRTs(RR R RRR(((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyRCs   ( R RtRRtobjectRR R(((s8build/bdist.linux-armv7l/egg/mxnet/gluon/data/dataset.pyts