code: def coalesce(
      edge_index: torch.Tensor,
      edge_attr: _typing.Union[
          torch.Tensor, _typing.Iterable[torch.Tensor], None
      ] = None,
      num_nodes: _typing.Optional[int] = ...,
      is_sorted: bool = False,
      sort_by_row: bool = True,
  ) -> _typing.Union[
      torch.Tensor,
      _typing.Tuple[torch.Tensor, torch.Tensor],
      _typing.Tuple[torch.Tensor, _typing.Iterable[torch.Tensor]],
  ]:
      """
      Row-wise sorts :obj:`edge_index` and removes its duplicated entries.
      Duplicate entries in :obj:`edge_attr` are directly removed, instead of merged.
      Args:
          edge_index (LongTensor): The edge indices.
          edge_attr (Tensor or List[Tensor], optional): Edge weights or multi-
              dimensional edge features.
              If given as a list, will re-shuffle and remove duplicates for all
              its entries. (default: :obj:`None`)
          num_nodes (int, optional): The number of nodes, *i.e.*
              :obj:`max_val + 1` of :attr:`edge_index`. (default: :obj:`None`)
          is_sorted (bool, optional): If set to :obj:`True`, will expect
              :obj:`edge_index` to be already sorted row-wise.
          sort_by_row (bool, optional): If set to :obj:`False`, will sort
              :obj:`edge_index` column-wise.
      :rtype: :class:`LongTensor` if :attr:`edge_attr` is :obj:`None`, else
          (:class:`LongTensor`, :obj:`Tensor` or :obj:`Iterable[Tensor]]`)
      """
      if not isinstance(num_nodes, int):
          num_nodes = None
      try:
          import torch_geometric
  
          return torch_geometric.utils.coalesce(
              edge_index,
              edge_attr,
              num_nodes,
              is_sorted=is_sorted,
              sort_by_row=sort_by_row,
          )
      except ModuleNotFoundError:
          return __coalesce(
              edge_index,
              edge_attr,
              num_nodes,
              is_sorted=is_sorted,
              sort_by_row=sort_by_row,
          )
  
file_path: AutoGL/autogl/datasets/utils/_split_edges/train_test_split_edges.py
imports: import math
  import torch
  import typing
label_desc: Use image node_id 3 for calling a global function with example usage: coalesce(edge_index, edge_attr, num_nodes, is_sorted, sort_by_row) and returns: torch_geometric, __coalesce