code: def dropout_adj(
      edge_index: Tensor,
      edge_attr: OptTensor = None,
      p: float = 0.5,
      force_undirected: bool = False,
      num_nodes: Optional[int] = None,
      training: bool = True,
  ) -> Tuple[Tensor, OptTensor]:
      r"""Randomly drops edges from the adjacency matrix
      :obj:`(edge_index, edge_attr)` with probability :obj:`p` using samples from
      a Bernoulli distribution.
  
      .. warning::
  
          :class:`~torch_geometric.utils.dropout_adj` is deprecated and will
          be removed in a future release.
          Use :class:`torch_geometric.utils.dropout_edge` instead.
  
      Args:
          edge_index (LongTensor): The edge indices.
          edge_attr (Tensor, optional): Edge weights or multi-dimensional
              edge features. (default: :obj:`None`)
          p (float, optional): Dropout probability. (default: :obj:`0.5`)
          force_undirected (bool, optional): If set to :obj:`True`, will either
              drop or keep both edges of an undirected edge.
              (default: :obj:`False`)
          num_nodes (int, optional): The number of nodes, *i.e.*
              :obj:`max_val + 1` of :attr:`edge_index`. (default: :obj:`None`)
          training (bool, optional): If set to :obj:`False`, this operation is a
              no-op. (default: :obj:`True`)
  
      Examples:
          >>> edge_index = torch.tensor([[0, 1, 1, 2, 2, 3],
          ...                            [1, 0, 2, 1, 3, 2]])
          >>> edge_attr = torch.tensor([1, 2, 3, 4, 5, 6])
          >>> dropout_adj(edge_index, edge_attr)
          (tensor([[0, 1, 2, 3],
                  [1, 2, 3, 2]]),
          tensor([1, 3, 5, 6]))
  
          >>> # The returned graph is kept undirected
          >>> dropout_adj(edge_index, edge_attr, force_undirected=True)
          (tensor([[0, 1, 2, 1, 2, 3],
                  [1, 2, 3, 0, 1, 2]]),
          tensor([1, 3, 5, 1, 3, 5]))
      """
      if p < 0.0 or p > 1.0:
          raise ValueError(
              f"Dropout probability has to be between 0 and 1 "
              f"(got {p}"
          )
  
      if not training or p == 0.0:
          return edge_index, edge_attr
  
      row, col = edge_index
  
      mask = torch.rand(row.size(0), device=edge_index.device) >= p
  
      if force_undirected:
          mask[row > col] = False
  
      row, col, edge_attr = filter_adj(row, col, edge_attr, mask)
  
      if force_undirected:
          edge_index = torch.stack(
              [
                  torch.cat([row, col], dim=0),
                  torch.cat([col, row], dim=0),
              ],
              dim=0,
          )
          if edge_attr is not None:
              edge_attr = torch.cat([edge_attr, edge_attr], dim=0)
      else:
          edge_index = torch.stack([row, col], dim=0)
  
      return edge_index, edge_attr
  
file_path: pytorch_geometric/torch_geometric/utils/dropout.py
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric import is_compiling
  from torch_geometric.deprecation import deprecated
  from torch_geometric.typing import OptTensor
  from torch_geometric.utils import cumsum, degree, sort_edge_index, subgraph
  from torch_geometric.utils.num_nodes import maybe_num_nodes
label_desc: Use image node_id 2 for calling a global function with example usage: dropout_adj(edge_index, edge_attr, p, force_undirected, num_nodes, training) and returns: edge_index,  edge_attr, edge_index,  edge_attr