'Generator that can be used to iterate over this dataset.
Yields:
tuple : the next minibatch of data.'

def __iter__(self):

    self.batch_index = 0
    shuf_idx = self.be.rng.permutation(len(self.story))
    self.story = self.story[shuf_idx]
    self.query = self.query[shuf_idx]
    self.answer = self.answer[shuf_idx]
    while (self.batch_index < self.nbatches):
        batch = slice((self.batch_index * self.be.bsz), ((self.batch_index + 1) * self.be.bsz))
        story_tensor = self.be.array(self.story[batch].T.copy())
        query_tensor = self.be.array(self.query[batch].T.copy())
        answer_tensor = self.be.array(self.answer[batch].T.copy())
        self.batch_index += 1
        (yield ((story_tensor, query_tensor), answer_tensor))
