def predict(self, model):
        sents = []
        targets = []
        y = self.be.zeros(self.dev_X.shape)
        for mb_idx, (x, t) in enumerate(self):
            y.fill(0)
            # Repeatedly generate next word in sentence and choose max prob word each time.
            for step in range(1, self.max_sentence_length+1):
                prob = model.fprop((x[0], y), inference=True).get()[:, :-self.be.bsz].copy()
                pred = np.argmax(prob, axis=0)
                prob.fill(0)
                for i in range(step * self.be.bsz):
                    prob[pred[i], i] = 1
                y[:] = prob
            sents += self.prob_to_word(y)
            # Test set, keep list of targets
            if isinstance(self, ImageCaptionTest):
                targets += t[0]
            # Train set, only 1 target
            else:
                targets.append(t[0])

        return sents, targets
Given a model, generate sentences from this dataset.
dataset/ETHPy150Open NervanaSystems/neon/neon/data/imagecaption.py/ImageCaption.predict