code: def train(node_index, node_label, gnn_model, graph, criterion, optim):
      gnn_model.train()
      pred = gnn_model(graph, graph.node_feat["words"])
      pred = paddle.gather(pred, node_index)
      loss = criterion(pred, node_label)
      loss.backward()
      acc = paddle.metric.accuracy(input=pred, label=node_label, k=1)
      for op in optim:
          op.step()
          op.clear_grad()
      return loss, acc
  
file_path: PGL/examples/bernnet/train.py
imports: import pgl
  import paddle
  import paddle.nn
  from pgl.utils.logger import log
  import paddle.nn.functional
  import numpy
  import time
  import argparse
  import yaml
  from easydict import EasyDict
  import tqdm
  from paddle.optimizer import Adam
  from utils import load_data
  from model import BernNet
label_desc: Use image node_id 1 for calling a global function with example usage: train(node_index, node_label, gnn_model, graph, criterion, optim) and returns: loss,  acc