code: def accuracy(logits, labels):
      """accuracy candies
      params:
        logits: [B, ..., D]
        labels: [B, ...]
      return:
        accuracy tensor
      """
      with tf.name_scope("accuracy"):
          assert_rank = tf.assert_equal(
              tf.rank(logits), tf.rank(labels) + 1
          )
          assert_shape = tf.assert_equal(
              tf.shape(logits)[:-1], tf.shape(labels)
          )
          with tf.control_dependencies([assert_rank, assert_shape]):
              predictions = tf.argmax(
                  logits, axis=-1, output_type=tf.int64
              )
              labels = tf.cast(labels, tf.int64)
              return tf.reduce_mean(
                  tf.cast(
                      tf.equal(predictions, labels), dtype=tf.float32
                  )
              )
  
label_desc: Use image node_id 1 for calling a global function with example usage: accuracy(logits, labels) and returns: tf