code: def accuracy(output, target):
      batch_size = target.size(0)
      _, predicted = torch.max(output.data, 1)
      return {"acc1": (predicted == target).sum().item() / batch_size}
  
file_path: nni/examples/nas/legacy/oneshot/naive/train.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torchvision
  import torchvision.transforms
  from nni.nas.pytorch.mutables import LayerChoice, InputChoice
  from nni.algorithms.nas.pytorch.darts import DartsTrainer
label_desc: Use image node_id 1 for calling a global function with example usage: accuracy(output, target) and returns: dict