class_docstr: The class for implementing PANet loss. This was partially adapted from
  https://github.com/whai362/pan_pp.pytorch and
  https://github.com/WenmuZhou/PAN.pytorch.
  
  PANet: `Efficient and Accurate Arbitrary-
  Shaped Text Detection with Pixel Aggregation Network
  <https://arxiv.org/abs/1908.05900>`_.
  
  Args:
      loss_text (dict) The loss config for text map. Defaults to
          dict(type='MaskedSquareDiceLoss').
      loss_kernel (dict) The loss config for kernel map. Defaults to
          dict(type='MaskedSquareDiceLoss').
      loss_embedding (dict) The loss config for embedding map. Defaults to
          dict(type='PANEmbLossV1').
      weight_text (float): The weight of text loss. Defaults to 1.
      weight_kernel (float): The weight of kernel loss. Defaults to 0.5.
      weight_embedding (float): The weight of embedding loss.
          Defaults to 0.25.
      ohem_ratio (float): The negative/positive ratio in ohem. Defaults to 3.
      shrink_ratio (tuple[float]) : The ratio of shrinking kernel. Defaults
          to (1.0, 0.5).
      max_shrink_dist (int or float): The maximum shrinking distance.
          Defaults to 20.
      reduction (str): The way to reduce the loss. Available options are
          "mean" and "sum". Defaults to 'mean'.
docstr: Generate the gt targets for PANet.
  
  Args:
      results (dict): The input result dictionary.
  
  Returns:
      results (dict): The output result dictionary.
docstr_tok: ["Generate","the","gt","targets","for","PANet",".","Args",":","results","(","dict",")",":","The","input","result","dictionary",".","Returns",":","results","(","dict",")",":","The","output","result","dictionary","."]
code: def get_targets(
      self,
      data_samples: Sequence[TextDetDataSample],
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Generate the gt targets for PANet.
  
      Args:
          results (dict): The input result dictionary.
  
      Returns:
          results (dict): The output result dictionary.
      """
      gt_kernels, gt_masks = multi_apply(
          self._get_target_single, data_samples
      )
      # gt_kernels: (N, kernel_number, H, W)->(kernel_number, N, H, W)
      gt_kernels = torch.stack(gt_kernels, dim=0).permute(1, 0, 2, 3)
      gt_masks = torch.stack(gt_masks, dim=0)
      return gt_kernels, gt_masks
  
imports: import warnings
  from typing import Dict, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from mmdet.models.utils import multi_apply
  from torch import nn
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from .seg_based_module_loss import SegBasedModuleLoss
label_desc: Use image node_id 3 for calling the PANModuleLoss obj's underlying member method code with example usage: obj.get_targets(data_samples) and returns: gt_kernels,  gt_masks