code: def main(args):
      # load graph data
      if args.dataset == "aifb":
          dataset = AIFBDataset()
      elif args.dataset == "mutag":
          dataset = MUTAGDataset()
      elif args.dataset == "bgs":
          dataset = BGSDataset()
      elif args.dataset == "am":
          dataset = AMDataset()
      else:
          raise ValueError()
  
      g = dataset[0]
      category = dataset.predict_category
      num_classes = dataset.num_classes
      test_mask = g.nodes[category].data.pop("test_mask")
      test_idx = th.nonzero(test_mask, as_tuple=False).squeeze()
      labels = g.nodes[category].data.pop("labels")
  
      # check cuda
      use_cuda = args.gpu >= 0 and th.cuda.is_available()
      if use_cuda:
          th.cuda.set_device(args.gpu)
          labels = labels.cuda()
          test_idx = test_idx.cuda()
          g = g.to("cuda:%d" % args.gpu)
  
      # create model
      model = EntityClassify(
          g,
          args.n_hidden,
          num_classes,
          num_bases=args.n_bases,
          num_hidden_layers=args.n_layers - 2,
          use_self_loop=args.use_self_loop,
      )
      model.load_state_dict(th.load(args.model_path))
      if use_cuda:
          model.cuda()
  
      print("start testing...")
      model.eval()
      logits = model.forward()[category]
      test_loss = F.cross_entropy(logits[test_idx], labels[test_idx])
      test_acc = th.sum(
          logits[test_idx].argmax(dim=1) == labels[test_idx]
      ).item() / len(test_idx)
      print(
          "Test Acc: {:.4f} | Test loss: {:.4f}".format(
              test_acc, test_loss.item()
          )
      )
      print()
  
imports: import argparse
  from functools import partial
  import torch
  import torch.nn.functional
  from dgl.data.rdf import AIFBDataset, AMDataset, BGSDataset, MUTAGDataset
  from entity_classify import EntityClassify
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types