code: def padded_accuracy(
      predictions, labels, weights_fn=common_layers.weights_nonzero
  ):
      """Percentage of times that predictions matches labels on non-0s."""
      # If the last dimension is 1 then we're using L1/L2 loss.
      if common_layers.shape_list(predictions)[-1] == 1:
          return rounding_accuracy(
              predictions, labels, weights_fn=weights_fn
          )
      with tf.variable_scope(
          "padded_accuracy", values=[predictions, labels]
      ):
          (
              padded_predictions,
              padded_labels,
          ) = common_layers.pad_with_zeros(predictions, labels)
          weights = weights_fn(padded_labels)
          outputs = tf.to_int32(tf.argmax(padded_predictions, axis=-1))
          padded_labels = tf.to_int32(padded_labels)
          return tf.to_float(tf.equal(outputs, padded_labels)), 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 19 for calling a global function with example usage: padded_accuracy(predictions, labels, weights_fn) and returns: rounding_accuracy, tf,  weights