(self, name, tensor, reduce_fn=tf.math.reduce_mean)
Add a summary for a scalar tensor.
Add a summary for a scalar tensor.
Add a summary for a scalar tensor .
def scalar(self, name, tensor, reduce_fn=tf.math.reduce_mean):
    """Add a summary for a scalar tensor."""
    if not self.record:
      return
    tensor = tf.convert_to_tensor(tensor)
    if tensor.shape.ndims == 0:
      tensor = tf.expand_dims(tensor, 0)
    self._entries.append(
        TpuSummaryEntry(summary.scalar, name, tensor, reduce_fn))
def scalar ( self , name , tensor , reduce_fn = tf . math . reduce_mean ) : if not self . record : return tensor = tf . convert_to_tensor ( tensor ) if tensor . shape . ndims == 0 : tensor = tf . expand_dims ( tensor , 0 ) self . _entries . append ( TpuSummaryEntry ( summary . scalar , name , tensor , reduce_fn ) )