'Generator that can be used to iterate over this dataset.
Yields:
tuple, tuple: first tuple contains image features and empty input Tensor
second tuple contains list of reference sentences and
placeholder for mask.'

def __iter__(self):

    for batch_idx in xrange(self.nbatches):
        start = (batch_idx * self.be.bsz)
        end = ((batch_idx + 1) * self.be.bsz)
        image_batch = self.images[start:end, :].T.astype(np.float32, order='C')
        self.dev_image.set(image_batch)
        (yield ((self.dev_image, self.dev_X), (self.ref_sents[start:end], None)))
