code: def edge_per(self, data, h):
      pos_edge_index = data.edge_index.detach().clone()
      pos_row, pos_col = pos_edge_index
      if self.undirected:
          pos_row, pos_col, _ = filter_adj(
              pos_row, pos_col, None, pos_row < pos_col
          )
  
      drop_logits = self.edge_per_mlp(
          torch.cat(
              (
                  h[pos_row] + h[pos_col],
                  torch.ones([len(pos_row), 1], device=h.device),
              ),
              dim=-1,
          )
      )
      drop_sample_logits = (
          drop_logits.detach().view(-1) * self.temperature
      )
      drop_mask = Bernoulli(logits=drop_sample_logits).sample()
  
      if self.magnitude is not None:
          keep_mask = (
              torch.empty(
                  [len(drop_mask)], dtype=torch.float32
              ).uniform_(0, 1)
              > self.magnitude
          )
          drop_mask[keep_mask] = 0.0
  
      pos_row, pos_col = (
          pos_row[(1.0 - drop_mask).bool()],
          pos_col[(1.0 - drop_mask).bool()],
      )
  
      if self.only_drop:
          new_row, new_col = pos_row, pos_col
      else:
          neg_row, neg_col = negative_sampling(
              data.edge_index,
              num_nodes=data.x.shape[0],
              num_neg_edge=pos_edge_index.shape[1],
              undirected=self.undirected,
          )
          add_logits = self.edge_per_mlp(
              torch.cat(
                  (
                      h[neg_row] + h[neg_col],
                      torch.zeros([len(neg_row), 1], device=h.device),
                  ),
                  dim=-1,
              )
          )
          add_sample_logits = (
              add_logits.detach().view(-1) * self.temperature
          )
          add_mask = Bernoulli(logits=add_sample_logits).sample()
  
          if self.magnitude is not None:
              keep_mask = (
                  torch.empty(
                      [len(add_mask)], dtype=torch.float32
                  ).uniform_(0, 1)
                  > self.magnitude
              )
              add_mask[keep_mask] = 0.0
  
          neg_row, neg_col = (
              neg_row[add_mask.bool()],
              neg_col[add_mask.bool()],
          )
          new_row, new_col = torch.cat(
              (pos_row, neg_row), dim=-1
          ), torch.cat((pos_col, neg_col), dim=-1)
  
      if self.undirected:
          new_edge_index = torch.stack(
              [
                  torch.cat([new_row, new_col], dim=0),
                  torch.cat([new_col, new_row], dim=0),
              ],
              dim=0,
          )
      else:
          new_edge_index = torch.cat([new_row, new_col], dim=0)
      new_edge_index = coalesce(
          new_edge_index, None, num_nodes=data.x.shape[0]
      )
  
      new_data = Data(x=data.x, edge_index=new_edge_index, y=data.y)
  
      if self.training:
          if self.only_drop:
              log_likelihood = -F.binary_cross_entropy_with_logits(
                  drop_logits.view(-1) * self.temperature,
                  drop_mask,
                  reduction="sum",
              )
          else:
              log_likelihood = -F.binary_cross_entropy_with_logits(
                  drop_logits.view(-1) * self.temperature,
                  drop_mask,
                  reduction="sum",
              ) - F.binary_cross_entropy_with_logits(
                  add_logits.view(-1), add_mask, reduction="sum"
              )
          return new_data, log_likelihood
  
      return new_data, None
  
file_path: DIG/dig/auggraph/method/GraphAug/aug/edge_per.py
imports: import torch
  import random
  import torch.nn.functional
  from torch.distributions.bernoulli import Bernoulli
  from torch_geometric.data import Data
  from torch_geometric.utils.dropout import filter_adj
  from torch_geometric.utils.num_nodes import maybe_num_nodes
  from .aug_utils import coalesce
label_desc: Use image node_id 5 for calling the EdgePer obj's underlying member method code with example usage: obj.edge_per(data, h) and returns: new_data,  None, new_data,  log_likelihood