code: def iou(preds, labels, C, EMPTY=1.0, ignore=None, per_image=False):
      """
      Array of IoU for each (non ignored) class
      """
      if not per_image:
          preds, labels = (preds,), (labels,)
      ious = []
      for pred, label in zip(preds, labels):
          iou = []
          for i in range(C):
              if (
                  i != ignore
              ):  # The ignored label is sometimes among predicted classes (ENet - CityScapes)
                  intersection = ((label == i) & (pred == i)).sum()
                  union = (
                      (label == i) | ((pred == i) & (label != ignore))
                  ).sum()
                  if not union:
                      iou.append(EMPTY)
                  else:
                      iou.append(float(intersection) / float(union))
          ious.append(iou)
      ious = [
          mean(iou) for iou in zip(*ious)
      ]  # mean accross images if per_image
      return 100 * np.array(ious)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.autograd import Variable
label_desc: Use image node_id 3 for calling a global function with example usage: iou(preds, labels, C, EMPTY, ignore, per_image) and returns: unknown