code: def multinomial_accuracy(y_true, y_pred):
      """Multinomial prediction accuracy. `y_true` is a tensor
      of integers, where the outermost dimension gives a draw
      from a Multinomial distribution.
  
      NB: In evaluating the accuracy between two Multinomials
      results may vary across evaluations. This is because Edward's
      algorithm for computing `y_pred`, i.e. the Multinomial
      mode, yields variable results if `any(isinstance(p, float)
      for p in total_count * probs)` (where `probs` is a vector
      of the predicted Multinomial probabilities).
      """
      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 8 for calling a global function with example usage: multinomial_accuracy(y_true, y_pred) and returns: tf