'Override the function for returning next batch.'

def next(self):

    batch_size = self.batch_size
    (c, h, w) = self.data_shape
    batch_data = nd.zeros((batch_size, c, h, w))
    batch_label = nd.empty(self.provide_label[0][1])
    batch_label[:] = (-1)
    i = 0
    try:
        while (i < batch_size):
            (label, s) = self.next_sample()
            data = self.imdecode(s)
            try:
                self.check_valid_image([data])
                label = self._parse_label(label)
                (data, label) = self.augmentation_transform(data, label)
                self._check_valid_label(label)
            except RuntimeError as e:
                logging.debug('Invalid    image,    skipping:        %s', str(e))
                continue
            for datum in [data]:
                assert (i < batch_size), 'Batch    size    must    be    multiples    of    augmenter    output    length'
                batch_data[i][:] = self.postprocess_data(datum)
                num_object = label.shape[0]
                batch_label[i][0:num_object] = nd.array(label)
                if (num_object < batch_label[i].shape[0]):
                    batch_label[i][num_object:] = (-1)
                i += 1
    except StopIteration:
        if (not i):
            raise StopIteration
    return io.DataBatch([batch_data], [batch_label], (batch_size - i))
