code: def accuracy(pred, target):
      # y is network output to be compared with ground truth (int)
      y = np.argmax(pred, axis=1)
      a = y == target
      correct = np.array(a, "int").sum()
      return correct
  
file_path: singa/examples/cnn/train_cnn.py
imports: from singa import singa_wrap
  from singa import device
  from singa import tensor
  from singa import opt
  import numpy
  import time
  import argparse
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: accuracy(pred, target) and returns: correct