code: def iou_single(a, b, mask, n_class):
      valid = mask == 1
      a = a.masked_select(valid)
      b = b.masked_select(valid)
      miou = []
      for i in range(n_class):
          if a.shape == [0] and a.shape == b.shape:
              inter = paddle.to_tensor(0.0)
              union = paddle.to_tensor(0.0)
          else:
              inter = ((a == i).logical_and(b == i)).astype("float32")
              union = ((a == i).logical_or(b == i)).astype("float32")
          miou.append(paddle.sum(inter) / (paddle.sum(union) + EPS))
      miou = sum(miou) / len(miou)
      return miou
  
label_desc: Use image node_id 1 for calling a global function with example usage: iou_single(a, b, mask, n_class) and returns: miou