def bleu_score(logits, labels):
    'Approximate BLEU score computation between labels and predictions.\n\n  An approximate BLEU scoring method since we do not glue word pieces or\n  decode the ids and tokenize the output. By default, we use ngram order of 4\n  and use brevity penalty. Also, this does not have beam search.\n\n  Args:\n    logits: Tensor of size [batch_size, length_logits, vocab_size]\n    labels: Tensor of size [batch-size, length_labels]\n\n  Returns:\n    bleu: int, approx bleu score\n  '
    predictions = tf.to_int32(tf.argmax(logits, axis=(- 1)))
    bleu = tf.py_func(compute_bleu, (labels, predictions), tf.float32)
    return (bleu, tf.constant(1.0))
Approximate BLEU score computation between labels and predictions.

An approximate BLEU scoring method since we do not glue word pieces or
decode the ids and tokenize the output. By default, we use ngram order of 4
and use brevity penalty. Also, this does not have beam search.

Args:
  logits: Tensor of size [batch_size, length_logits, vocab_size]
  labels: Tensor of size [batch-size, length_labels]

Returns:
  bleu: int, approx bleu score
def bleu_score(logits, labels):
    'Approximate BLEU score computation between labels and predictions.\n\n  An approximate BLEU scoring method since we do not glue word pieces or\n  decode the ids and tokenize the output. By default, we use ngram order of 4\n  and use brevity penalty. Also, this does not have beam search.\n\n  Args:\n    logits: Tensor of size [batch_size, length_logits, vocab_size]\n    labels: Tensor of size [batch-size, length_labels]\n\n  Returns:\n    bleu: int, approx bleu score\n  '
    predictions = tf.to_int32(tf.argmax(logits, axis=(- 1)))
    bleu = tf.py_func(compute_bleu, (labels, predictions), tf.float32)
    return (bleu, tf.constant(1.0))