parameters: (tensor,
                    tensor_name,
                    np_printoptions,
                    print_all=False,
                    tensor_slicing=None,
                    highlight_options=None,
                    include_numeric_summary=False)
return_statement: return tensor_format.format_tensor(
        value,
        sliced_name,
        include_metadata=True,
        include_numeric_summary=include_numeric_summary,
        np_printoptions=np_printoptions,
        highlight_options=highlight_options)
docstring: Generate formatted str to represent a tensor or its slices.
  
    Args:
      tensor: (numpy ndarray) The tensor value.
      tensor_name: (str) Name of the tensor, e.g., the tensor's debug watch key.
      np_printoptions: (dict) Numpy tensor formatting options.
      print_all: (bool) Whether the tensor is to be displayed in its entirety,
        instead of printing ellipses, even if its number of elements exceeds
        the default numpy display threshold.
        (Note: Even if this is set to true, the screen output can still be cut
         off by the UI frontend if it consist of more lines than the frontend
         can handle.)
      tensor_slicing: (str or None) Slicing of the tensor, e.g., "[:, 1]". If
        None, no slicing will be performed on the tensor.
      highlight_options: (tensor_format.HighlightOptions) options to highlight
        elements of the tensor. See the doc of tensor_format.format_tensor()
        for more details.
      include_numeric_summary: Whether a text summary of the numeric values (if
        applicable) will be included.
  
    Returns:
      An instance of `debugger_cli_common.RichTextLines` representing the
      (potentially sliced) tensor.
docstring_summary: Generate formatted str to represent a tensor or its slices.
docstring_tokens: Generate formatted str to represent a tensor or its slices .
function: def format_tensor(tensor,
                    tensor_name,
                    np_printoptions,
                    print_all=False,
                    tensor_slicing=None,
                    highlight_options=None,
                    include_numeric_summary=False):
    """Generate formatted str to represent a tensor or its slices.
  
    Args:
      tensor: (numpy ndarray) The tensor value.
      tensor_name: (str) Name of the tensor, e.g., the tensor's debug watch key.
      np_printoptions: (dict) Numpy tensor formatting options.
      print_all: (bool) Whether the tensor is to be displayed in its entirety,
        instead of printing ellipses, even if its number of elements exceeds
        the default numpy display threshold.
        (Note: Even if this is set to true, the screen output can still be cut
         off by the UI frontend if it consist of more lines than the frontend
         can handle.)
      tensor_slicing: (str or None) Slicing of the tensor, e.g., "[:, 1]". If
        None, no slicing will be performed on the tensor.
      highlight_options: (tensor_format.HighlightOptions) options to highlight
        elements of the tensor. See the doc of tensor_format.format_tensor()
        for more details.
      include_numeric_summary: Whether a text summary of the numeric values (if
        applicable) will be included.
  
    Returns:
      An instance of `debugger_cli_common.RichTextLines` representing the
      (potentially sliced) tensor.
    """
  
    if tensor_slicing:
      # Validate the indexing.
      value = command_parser.evaluate_tensor_slice(tensor, tensor_slicing)
      sliced_name = tensor_name + tensor_slicing
    else:
      value = tensor
      sliced_name = tensor_name
  
    if print_all:
      np_printoptions["threshold"] = value.size
    else:
      np_printoptions["threshold"] = DEFAULT_NDARRAY_DISPLAY_THRESHOLD
  
    return tensor_format.format_tensor(
        value,
        sliced_name,
        include_metadata=True,
        include_numeric_summary=include_numeric_summary,
        np_printoptions=np_printoptions,
        highlight_options=highlight_options)
function_tokens: def format_tensor ( tensor , tensor_name , np_printoptions , print_all = False , tensor_slicing = None , highlight_options = None , include_numeric_summary = False ) : if tensor_slicing : # Validate the indexing. value = command_parser . evaluate_tensor_slice ( tensor , tensor_slicing ) sliced_name = tensor_name + tensor_slicing else : value = tensor sliced_name = tensor_name if print_all : np_printoptions [ "threshold" ] = value . size else : np_printoptions [ "threshold" ] = DEFAULT_NDARRAY_DISPLAY_THRESHOLD return tensor_format . format_tensor ( value , sliced_name , include_metadata = True , include_numeric_summary = include_numeric_summary , np_printoptions = np_printoptions , highlight_options = highlight_options )