Table Of Contents
Table Of Contents

ResizeIter

class mxnet.io.ResizeIter(data_iter, size, reset_internal=True)[source]

Resize 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)
[<NDArray 25x10 @cpu(0)>]
[<NDArray 25x10 @cpu(0)>]
__init__(data_iter, size, reset_internal=True)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(data_iter, size[, reset_internal]) Initialize self.
getdata() Get data of current batch.
getindex() Get index of the current batch.
getlabel() Get label of the current batch.
getpad() Get the number of padding examples in the current batch.
iter_next() Move to the next batch.
next() Get next data batch from iterator.
reset() Reset the iterator to the begin of the data.