code: def compute_acc(emb, labels, train_nids, val_nids, test_nids):
      """
      Compute the accuracy of prediction given the labels.
  
      We will fist train a LogisticRegression model using the trained embeddings,
      the training set, validation set and test set is provided as the arguments.
  
      The final result is predicted by the lr model.
  
      emb: The pretrained embeddings
      labels: The ground truth
      train_nids: The training set node ids
      val_nids: The validation set node ids
      test_nids: The test set node ids
      """
  
      emb = emb[np.arange(labels.shape[0])].cpu().numpy()
      train_nids = train_nids.cpu().numpy()
      val_nids = val_nids.cpu().numpy()
      test_nids = test_nids.cpu().numpy()
      labels = labels.cpu().numpy()
  
      emb = (emb - emb.mean(0, keepdims=True)) / emb.std(
          0, keepdims=True
      )
      lr = lm.LogisticRegression(
          multi_class="multinomial", max_iter=10000
      )
      lr.fit(emb[train_nids], labels[train_nids])
  
      pred = lr.predict(emb)
      eval_acc = skm.accuracy_score(labels[val_nids], pred[val_nids])
      test_acc = skm.accuracy_score(labels[test_nids], pred[test_nids])
      return eval_acc, test_acc
  
imports: import argparse
  import time
  from contextlib import contextmanager
  import numpy
  import sklearn.linear_model
  import sklearn.metrics
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import tqdm
  import dgl
  import dgl.function
  import dgl.nn.pytorch
label_desc: Use image node_id 3 for calling a global function with example usage: compute_acc(emb, labels, train_nids, val_nids, test_nids) and returns: eval_acc,  test_acc