code: def sparse_categorical_accuracy(y_true, y_pred):
      """Multi-class prediction accuracy. Label {0, 1, .., K-1}
      representation for `y_true`.
  
      Args:
        y_true: tf.Tensor.
          Tensor of integers {0, 1, ..., K-1}.
        y_pred: tf.Tensor.
          Tensor of predictions, with same shape as `y_true`.
      """
      y_true = tf.cast(y_true, tf.float32)
      y_pred = tf.cast(y_pred, tf.float32)
      return tf.reduce_mean(
          tf.cast(tf.equal(y_true, y_pred), tf.float32)
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import six
  import tensorflow
  from edward.models import RandomVariable
  from edward.util import check_data, get_session, compute_multinomial_mode, with_binary_averaging
label_desc: Use image node_id 4 for calling a global function with example usage: sparse_categorical_accuracy(y_true, y_pred) and returns: tf