code: def train(g, features, labels, masks, model):
      # define train/val samples, loss function and optimizer
      train_mask = masks[0]
      val_mask = masks[1]
      loss_fcn = nn.CrossEntropyLoss()
      optimizer = torch.optim.Adam(
          model.parameters(), lr=1e-2, weight_decay=5e-4
      )
  
      # training loop
      for epoch in range(200):
          model.train()
          logits = model(g, features)
          loss = loss_fcn(logits[train_mask], labels[train_mask])
          optimizer.zero_grad()
          loss.backward()
          optimizer.step()
          acc = evaluate(g, features, labels, val_mask, model)
          print(
              "Epoch {:05d} | Loss {:.4f} | Accuracy {:.4f} ".format(
                  epoch, loss.item(), acc
              )
          )
  
file_path: dgl/examples/pytorch/gcn/train.py
imports: import argparse
  import dgl
  import dgl.nn
  import torch
  import torch.nn
  import torch.nn.functional
  from dgl import AddSelfLoop
  from dgl.data import CiteseerGraphDataset, CoraGraphDataset, PubmedGraphDataset
label_desc: Use image node_id 2 for calling a global function with example usage: train(g, features, labels, masks, model) without return types