class_docstr: Loss function for HoVerNet pipeline, which is combination of losses across the three branches.
  The NP (nucleus prediction) branch uses Dice + CrossEntropy.
  The HV (Horizontal and Vertical) distance from centroid branch uses MSE + MSE of the gradient.
  The NC (Nuclear Class prediction) branch uses Dice + CrossEntropy
  The result is a weighted sum of these losses.
  
  Args:
      lambda_hv_mse: Weight factor to apply to the HV regression MSE part of the overall loss
      lambda_hv_mse_grad: Weight factor to apply to the MSE of the HV gradient part of the overall loss
      lambda_np_ce: Weight factor to apply to the nuclei prediction CrossEntropyLoss part
          of the overall loss
      lambda_np_dice: Weight factor to apply to the nuclei prediction DiceLoss part of overall loss
      lambda_nc_ce: Weight factor to apply to the nuclei class prediction CrossEntropyLoss part
          of the overall loss
      lambda_nc_dice: Weight factor to apply to the nuclei class prediction DiceLoss part of the
          overall loss
code: def __init__(
      self,
      lambda_hv_mse: float = 2.0,
      lambda_hv_mse_grad: float = 1.0,
      lambda_np_ce: float = 1.0,
      lambda_np_dice: float = 1.0,
      lambda_nc_ce: float = 1.0,
      lambda_nc_dice: float = 1.0,
  ) -> None:
      self.lambda_hv_mse = lambda_hv_mse
      self.lambda_hv_mse_grad = lambda_hv_mse_grad
      self.lambda_np_ce = lambda_np_ce
      self.lambda_np_dice = lambda_np_dice
      self.lambda_nc_ce = lambda_nc_ce
      self.lambda_nc_dice = lambda_nc_dice
      super().__init__()
  
      self.dice = DiceLoss(
          softmax=True,
          smooth_dr=1e-03,
          smooth_nr=1e-03,
          reduction="sum",
          batch=True,
      )
      self.ce = CrossEntropyLoss(reduction="mean")
      self.sobel_v = SobelGradients(kernel_size=5, spatial_axes=0)
      self.sobel_h = SobelGradients(kernel_size=5, spatial_axes=1)
  
file_path: MONAI/monai/apps/pathology/losses/hovernet_loss.py
imports: from __future__ import annotations
  import torch
  from torch.nn import CrossEntropyLoss
  from torch.nn import functional
  from torch.nn.modules.loss import _Loss
  from monai.losses import DiceLoss
  from monai.transforms import SobelGradients
  from monai.utils.enums import HoVerNetBranch
label_desc: Use image node_id 1 to create a new HoVerNetLoss object from inherited base classes: _Loss with example: obj = HoVerNetLoss(lambda_hv_mse, lambda_hv_mse_grad, lambda_np_ce, lambda_np_dice, lambda_nc_ce, lambda_nc_dice)