code: def _add_scalar_summary(tensor, tag=None):
      """Add a scalar summary operation for the tensor.
  
      Args:
        tensor: The tensor to summarize.
        tag: The tag to use, if None then use tensor's op's name.
  
      Returns:
        The created histogram summary.
  
      Raises:
        ValueError: If the tag is already in use or the rank is not 0.
      """
      tensor.get_shape().assert_has_rank(0)
      tag = tag or "%s_summary" % tensor.op.name
      return summary.scalar(tag, tensor)
  
file_path: tensornets/tensornets/contrib_layers/summaries.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import re
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import standard_ops
  from tensorflow.python.summary import summary
label_desc: Use image node_id 1 for calling a global function with example usage: _add_scalar_summary(tensor, tag) and returns: summary