code: def __init__(
      self,
      per_image: bool = False,
      ignore_index: Optional[Union[int, float]] = None,
  ):
      super().__init__()
      self.ignore_index = ignore_index
      self.per_image = per_image
  
imports: from __future__ import print_function, division
  from typing import Optional, Union
  import torch
  import torch.nn.functional
  from torch.autograd import Variable
  from torch.nn.modules.loss import _Loss
label_desc: Use image node_id 1 to create a new BinaryLovaszLoss object from inherited base classes: _Loss with example: obj = BinaryLovaszLoss(per_image, ignore_index)