Table Of Contents
Table Of Contents

DataBatch

class mxnet.io.DataBatch(data, label=None, pad=None, index=None, bucket_key=None, provide_data=None, provide_label=None)[source]

A 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].
__init__(data, label=None, pad=None, index=None, bucket_key=None, provide_data=None, provide_label=None)[source]

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

Methods

__init__(data[, label, pad, index, …]) Initialize self.