def valid_step(self, sample, model, criterion):
    (loss, sample_size, logging_output) = super().valid_step(sample, model, criterion)
    if self.args.eval_bleu:
        bleu = self._inference_with_bleu(self.sequence_generator, sample, model)
        logging_output['_bleu_sys_len'] = bleu.sys_len
        logging_output['_bleu_ref_len'] = bleu.ref_len
        assert (len(bleu.counts) == EVAL_BLEU_ORDER)
        for i in range(EVAL_BLEU_ORDER):
            logging_output[('_bleu_counts_' + str(i))] = bleu.counts[i]
            logging_output[('_bleu_totals_' + str(i))] = bleu.totals[i]
    return (loss, sample_size, logging_output)
def valid_step(self, sample, model, criterion):
    (loss, sample_size, logging_output) = super().valid_step(sample, model, criterion)
    if self.args.eval_bleu:
        bleu = self._inference_with_bleu(self.sequence_generator, sample, model)
        logging_output['_bleu_sys_len'] = bleu.sys_len
        logging_output['_bleu_ref_len'] = bleu.ref_len
        assert (len(bleu.counts) == EVAL_BLEU_ORDER)
        for i in range(EVAL_BLEU_ORDER):
            logging_output[('_bleu_counts_' + str(i))] = bleu.counts[i]
            logging_output[('_bleu_totals_' + str(i))] = bleu.totals[i]
    return (loss, sample_size, logging_output)