code: def bleu_score(predictions, labels, **unused_kwargs):
      """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:
        predictions: tensor, model predictions
        labels: tensor, gold output.
  
      Returns:
        bleu: int, approx bleu score
      """
      outputs = tf.to_int32(tf.argmax(predictions, axis=-1))
      # Convert the outputs and labels to a [batch_size, input_length] tensor.
      outputs = tf.squeeze(outputs, axis=[-1, -2])
      labels = tf.squeeze(labels, axis=[-1, -2])
  
      bleu = tf.py_func(compute_bleu, (labels, outputs), tf.float32)
      return bleu, tf.constant(1.0)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import math
  import os
  import re
  import sys
  import time
  import unicodedata
  import numpy
  import six
  from six.moves import range
  from six.moves import zip
  from tensor2tensor.data_generators import text_encoder
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: bleu_score(predictions, labels) and returns: bleu,  tf