code: def accuracy_np(output, target):
      max_indices = np.argsort(output, axis=1)[:, ::-1]
      top5 = (
          100
          * np.equal(max_indices[:, :5], target[:, np.newaxis])
          .sum(axis=1)
          .mean()
      )
      top1 = 100 * np.equal(max_indices[:, 0], target).mean()
      return top1, top5
  
file_path: gen-efficientnet-pytorch/caffe2_validate.py
imports: import argparse
  import numpy
  from caffe2.python import core, workspace, model_helper
  from caffe2.proto import caffe2_pb2
  from data import create_loader, resolve_data_config, Dataset
  from utils import AverageMeter
  import time
label_desc: Use image node_id 2 for calling a global function with example usage: accuracy_np(output, target) and returns: top1,  top5