code: def train(model, dataloaders, optimizer, args, scheduler=None):
      # training loop
      val_max = -math.inf
      best_model = model
      t_accu = []
      v_accu = []
      e_accu = []
      for epoch in range(1, args.epochs):
          for iter_i, batch in enumerate(dataloaders["train"]):
              start_t = time.time()
              batch.to(args.device)
              model.train()
              optimizer.zero_grad()
              pred = model(batch)
              loss = model.loss(pred, batch.edge_label.type(pred.dtype))
              print("loss: ", loss.item())
              loss.backward()
              optimizer.step()
              if scheduler is not None:
                  scheduler.step()
  
              log = "Epoch: {:03d}, Train: {:.4f}, Val: {:.4f}, Test: {:.4f}"
              accs, _ = test(model, dataloaders, args)
              t_accu.append(accs["train"])
              v_accu.append(accs["val"])
              e_accu.append(accs["test"])
  
              print(
                  log.format(
                      epoch, accs["train"], accs["val"], accs["test"]
                  )
              )
              if val_max < accs["val"]:
                  val_max = accs["val"]
                  best_model = copy.deepcopy(model)
              print("Time: ", time.time() - start_t)
  
      log = "Best, Train: {:.4f}, Val: {:.4f}, Test: {:.4f}"
      accs, _ = test(best_model, dataloaders, args)
      print(log.format(accs["train"], accs["val"], accs["test"]))
  
imports: import sys
  import argparse
  from converter import *
  import copy
  import math
  import time
  import numpy
  from sklearn.metrics import *
  import torch
  import torch.nn.functional
  from torch.utils.data import DataLoader
  from torch_geometric.datasets import Planetoid
  from torch_geometric.datasets import TUDataset
  import torch_geometric.transforms
  import torch_geometric.nn
  from deepsnap.graph import Graph
  from deepsnap.dataset import GraphDataset
  from deepsnap.batch import Batch
  import pdb
label_desc: Use image node_id 2 for calling a global function with example usage: train(model, dataloaders, optimizer, args, scheduler) without return types