code: def lovasz_softmax(probas, labels, only_present=False, per_image=False, ignore=None):
      
      if per_image:
          loss = mean(lovasz_softmax_flat(*flatten_probas(prob.unsqueeze(0), lab.unsqueeze(0), ignore), only_present=only_present)
                            for prob, lab in zip(probas, labels))
      else:
          loss = lovasz_softmax_flat(*flatten_probas(probas, labels, ignore), only_present=only_present)
      return loss
docs: Multi-class Lovasz-Softmax loss
        probas: [B, C, H, W] Variable, class probabilities at each prediction (between 0 and 1)
        labels: [B, H, W] Tensor, ground truth labels (between 0 and C - 1)
        only_present: average only on classes present in ground truth
        per_image: compute the loss per image instead of per batch
        ignore: void class labels