(loss, logits, one_hot_labels, name="softmax")
Create the softmax summaries for this cross entropy loss.

  Args:
    loss: Cross-entropy loss.
    logits: The [batch_size, classes] float tensor representing the logits.
    one_hot_labels: The float tensor representing actual class ids. If this is
      [batch_size, classes], then we take the argmax of it first.
    name: Prepended to summary scope.
Create the softmax summaries for this cross entropy loss.
Create the softmax summaries for this cross entropy loss .
def softmax_summaries(loss, logits, one_hot_labels, name="softmax"):
  """Create the softmax summaries for this cross entropy loss.

  Args:
    loss: Cross-entropy loss.
    logits: The [batch_size, classes] float tensor representing the logits.
    one_hot_labels: The float tensor representing actual class ids. If this is
      [batch_size, classes], then we take the argmax of it first.
    name: Prepended to summary scope.
  """
  tf.summary.scalar(name + "_loss", loss)

  one_hot_labels = tf.cond(
      tf.equal(tf.rank(one_hot_labels),
               2), lambda: tf.to_int32(tf.argmax(one_hot_labels, 1)),
      lambda: tf.to_int32(one_hot_labels))

  in_top_1 = tf.nn.in_top_k(logits, one_hot_labels, 1)
  tf.summary.scalar(name + "_precision@1",
                    tf.reduce_mean(tf.to_float(in_top_1)))
  in_top_5 = tf.nn.in_top_k(logits, one_hot_labels, 5)
  tf.summary.scalar(name + "_precision@5",
                    tf.reduce_mean(tf.to_float(in_top_5)))
def softmax_summaries ( loss , logits , one_hot_labels , name = "softmax" ) : tf . summary . scalar ( name + "_loss" , loss ) one_hot_labels = tf . cond ( tf . equal ( tf . rank ( one_hot_labels ) , 2 ) , lambda : tf . to_int32 ( tf . argmax ( one_hot_labels , 1 ) ) , lambda : tf . to_int32 ( one_hot_labels ) ) in_top_1 = tf . nn . in_top_k ( logits , one_hot_labels , 1 ) tf . summary . scalar ( name + "_precision@1" , tf . reduce_mean ( tf . to_float ( in_top_1 ) ) ) in_top_5 = tf . nn . in_top_k ( logits , one_hot_labels , 5 ) tf . summary . scalar ( name + "_precision@5" , tf . reduce_mean ( tf . to_float ( in_top_5 ) ) )