code: def train(model, embeds, lazy_adj, args):
      patience = 0
      _, _, last_acc, last_output = model_test(model, embeds)
  
      tv_mask = model.tv_mask
      optimizer = optim.SGD(model.parameters(), lr=args.lr_clf)
  
      for i in range(64):
          model.train()
          output = model(embeds)
          loss_tv = F.mse_loss(
              output[tv_mask],
              model.label_one_hot[tv_mask],
              reduction="sum",
          )
          optimizer.zero_grad()
          loss_tv.backward()
          optimizer.step()
  
          # Updating node embeds by LGC and SEB jointly.
          embeds = model.update_embeds(embeds, lazy_adj, args)
  
          loss_tv, acc_tv, acc_test, pred = model_test(model, embeds)
          print(
              "epoch {} loss_tv {:.4f} acc_tv {:.4f} acc_test {:.4f}".format(
                  i + 1, loss_tv, acc_tv, acc_test
              )
          )
  
          sim_rate = float(
              int((pred == last_output).sum()) / int(pred.shape[0])
          )
          if sim_rate > args.max_sim_rate:
              patience += 1
              if patience > args.max_patience:
                  break
          last_acc = acc_test
          last_output = pred
      return last_acc
  
file_path: dgl/examples/pytorch/ogc/train.py
imports: import argparse
  import time
  import dgl.sparse
  import torch.nn.functional
  import torch.optim
  from dgl import AddSelfLoop
  from dgl.data import CiteseerGraphDataset, CoraGraphDataset, PubmedGraphDataset
  from ogc import OGC
  from utils import model_test, symmetric_normalize_adjacency
label_desc: Use image node_id 1 for calling a global function with example usage: train(model, embeds, lazy_adj, args) and returns: last_acc