code: def train(model, optimizer, H, X, Y, train_mask):
      model.train()
      Y_hat = model(H, X)
      loss = F.cross_entropy(Y_hat[train_mask], Y[train_mask])
      optimizer.zero_grad()
      loss.backward()
      optimizer.step()
      return loss.item()
  
imports: import argparse
  import dgl.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  import tqdm
  from dgl.data import CoraGraphDataset
  from torchmetrics.functional import accuracy
label_desc: Use image node_id 2 for calling a global function with example usage: train(model, optimizer, H, X, Y, train_mask) and returns: loss