docs: def _summary(self, name, tensor):
      """Create a scalar or histogram summary matching the rank of the tensor.
  
      Args:
        name: Name for the summary.
        tensor: Tensor to summarize.
  
      Returns:
        Summary tensor.
      """
      if tensor.shape.ndims == 0:
        return tf.summary.scalar(name, tensor)
      else:
        return tf.summary.histogram(name, tensor)