code: def _summarize_eager(tensor, summarize=None):
      """Returns a summarized string representation of eager `tensor`.
  
      Args:
        tensor: EagerTensor to summarize
        summarize: Include these many first elements of `array`
      """
      # Emulate the behavior of Tensor::SummarizeValue()
      if summarize is None:
          summarize = 3
      elif summarize < 0:
          summarize = array_ops.size(tensor)
  
      # reshape((-1,)) is the fastest way to get a flat array view
      if tensor._rank():  # pylint: disable=protected-access
          flat = tensor.numpy().reshape((-1,))
          lst = [str(x) for x in flat[:summarize]]
          if len(lst) < flat.size:
              lst.append("...")
      else:
          # tensor.numpy() returns a scalar for zero dimensional arrays
          if gen_math_ops.not_equal(summarize, 0):
              lst = [str(tensor.numpy())]
          else:
              lst = []
  
      return ", ".join(lst)
  
file_path: tensorflow-upstream/tensorflow/python/ops/control_flow_assert.py
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import gen_control_flow_ops
  from tensorflow.python.ops import gen_logging_ops
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.util import dispatch
  from tensorflow.python.util import tf_should_use
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: _summarize_eager(tensor, summarize) and returns: str