'Returns the next batch of data.'

def next(self):

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