code: def contains_self_loops(edge_index: Tensor) -> bool:
      r"""Returns :obj:`True` if the graph given by :attr:`edge_index` contains
      self-loops.
  
      Args:
          edge_index (LongTensor): The edge indices.
  
      :rtype: bool
  
      Examples:
          >>> edge_index = torch.tensor([[0, 1, 0],
          ...                            [1, 0, 0]])
          >>> contains_self_loops(edge_index)
          True
  
          >>> edge_index = torch.tensor([[0, 1, 1],
          ...                            [1, 0, 2]])
          >>> contains_self_loops(edge_index)
          False
      """
      mask = edge_index[0] == edge_index[1]
      return mask.sum().item() > 0
  
imports: import typing
  from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor
  from torch_geometric import EdgeIndex
  from torch_geometric.utils import scatter
  from torch_geometric.utils.num_nodes import maybe_num_nodes
  from torch_geometric.utils.sparse import is_torch_sparse_tensor, to_edge_index, to_torch_coo_tensor, to_torch_csr_tensor
label_desc: Use image node_id 1 for calling a global function with example usage: contains_self_loops(edge_index) and returns: unknown