code: def summarize_features(features, num_shards=1):
    
    if not common_layers.should_generate_summaries():
      return
  
    with tf.name_scope("input_stats"):
      for (k, v) in sorted(six.iteritems(features)):
        if (isinstance(v, tf.Tensor) and (v.get_shape().ndims > 1) and
            (v.dtype != tf.string)):
          tf.summary.scalar("%s_batch" % k, tf.shape(v)[0] // num_shards)
          tf.summary.scalar("%s_length" % k, tf.shape(v)[1])
          nonpadding = tf.to_float(tf.not_equal(v, 0))
          nonpadding_tokens = tf.reduce_sum(nonpadding)
          tf.summary.scalar("%s_nonpadding_tokens" % k, nonpadding_tokens)
          tf.summary.scalar("%s_nonpadding_fraction" % k,
                            tf.reduce_mean(nonpadding))
docs: Generate summaries for features.