code: def train(epoch):
      model.train()
  
      pbar = tqdm(total=split_idx["train"].size(0))
      pbar.set_description(f"Epoch {epoch:02d}")
  
      total_loss = total_correct = 0
      for batch in train_loader:
          optimizer.zero_grad()
          out = model(batch.x, batch.edge_index.to(device))[
              : batch.batch_size
          ]
          y = batch.y[: batch.batch_size].squeeze()
          loss = F.cross_entropy(out, y)
          loss.backward()
          optimizer.step()
  
          total_loss += float(loss)
          total_correct += int(out.argmax(dim=-1).eq(y).sum())
          pbar.update(batch.batch_size)
  
      pbar.close()
  
      loss = total_loss / len(train_loader)
      approx_acc = total_correct / split_idx["train"].size(0)
  
      return loss, approx_acc
  
file_path: pytorch_geometric/examples/ogbn_products_sage.py
imports: import os.path
  import torch
  import torch.nn.functional
  from ogb.nodeproppred import Evaluator, PygNodePropPredDataset
  from tqdm import tqdm
  from torch_geometric.loader import NeighborLoader
  from torch_geometric.nn import SAGEConv
label_desc: Use image node_id 1 for calling a global function with example usage: train(epoch) and returns: loss,  approx_acc