code: def add_scalar_summary(self, x, tag=None):
      
      if not self.summary_collections:
        return
      with self.g.as_default():
        tag = tag or _tag_for(x.name)
        summary = (tf.summary.scalar(
            tag, x, collections=self.summary_collections))
        return summary
docs: Adds a scalar summary for x.