code: def multilabel_accuracy_matchk(
      predictions, labels, k, weights_fn=common_layers.weights_nonzero
  ):
      """Used to evaluate the VQA accuracy.
  
      Let n be the times that predictions appear in labels, then final score
      is min(n/k, 1).
      Refer to https://arxiv.org/pdf/1505.00468.pdf.
  
      Args:
        predictions: A tensor with shape [batch_size, 1, 1, 1, vocab_size].
        labels: A tensor with shape [batch_size, length, 1, 1].
        k: A tensor constant.
        weights_fn: weight function.
      Returns:
        scores: min(n/k, 1).
        weights: returns all ones.
  
      """
      predictions = tf.to_int32(tf.argmax(predictions, axis=-1))
      scores = tf.to_float(tf.equal(predictions, labels))
      # those label == 0 do not count
      weights = weights_fn(labels)
      scores *= weights
      scores = tf.reduce_sum(scores, axis=[1, 2, 3])
      scores = tf.minimum(scores / tf.to_float(k), 1)
      # every sample count
      weights = tf.ones(tf.shape(scores), dtype=tf.float32)
  
      return scores, weights
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import six
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import bleu_hook
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import rouge
  from tensor2tensor.utils import sari_hook
  import tensorflow.compat.v1
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 20 for calling a global function with example usage: multilabel_accuracy_matchk(predictions, labels, k, weights_fn) and returns: scores,  weights