code: def train():
      model.train()
  
      total_loss = total_examples = 0
      for data in tqdm.tqdm(loader):
          data = data.to(device)
          optimizer.zero_grad()
          h = model(data.x, data.edge_index)
  
          h_src = h[data.edge_label_index[0]]
          h_dst = h[data.edge_label_index[1]]
          link_pred = (h_src * h_dst).sum(dim=-1)  # Inner product.
  
          loss = F.binary_cross_entropy_with_logits(
              link_pred, data.edge_label
          )
          loss.backward()
          optimizer.step()
  
          total_loss += float(loss) * link_pred.numel()
          total_examples += link_pred.numel()
  
      return total_loss / total_examples
  
file_path: pytorch_geometric/examples/graph_sage_unsup_ppi.py
imports: import os.path
  import time
  import torch
  import torch.nn.functional
  import tqdm
  from sklearn.linear_model import SGDClassifier
  from sklearn.metrics import f1_score
  from sklearn.multioutput import MultiOutputClassifier
  from torch_geometric.data import Batch
  from torch_geometric.datasets import PPI
  from torch_geometric.loader import DataLoader, LinkNeighborLoader
  from torch_geometric.nn import GraphSAGE
label_desc: Use image node_id 1 for calling a global function with example usage: train() and returns: unknown