code: def test(model, graph, indices, best_model=None, best_val=0):
      model.eval()
      accs = []
      for index in indices:
          preds = model(graph.node_feature, graph.edge_index)
          num_node_types = 0
          micro = 0
          macro = 0
          for node_type in preds:
              idx = index[node_type]
              pred = preds[node_type][idx]
              pred = pred.max(1)[1]
              label_np = graph.node_label[node_type][idx].cpu().numpy()
              pred_np = pred.cpu().numpy()
              micro = f1_score(label_np, pred_np, average="micro")
              macro = f1_score(label_np, pred_np, average="macro")
              num_node_types += 1
          # Averaging f1 score might not make sense, but in our example we only
          # have one node type
          micro /= num_node_types
          macro /= num_node_types
          accs.append((micro, macro))
      if accs[1][0] > best_val:
          best_val = accs[1][0]
          best_model = copy.deepcopy(model)
      return accs, best_model, best_val
  
imports: import copy
  import torch
  import argparse
  import deepsnap
  import numpy
  import torch.nn
  import torch.nn.functional
  import torch_geometric.nn
  from sklearn.metrics import f1_score
  from deepsnap.hetero_gnn import forward_op, HeteroSAGEConv
  from deepsnap.hetero_graph import HeteroGraph
  from torch_sparse import SparseTensor, matmul
label_desc: Use image node_id 4 for calling a global function with example usage: test(model, graph, indices, best_model, best_val) and returns: accs,  best_model,  best_val