class_docstr: The class for implementing EmbLossV1. This was partially adapted from
  https://github.com/whai362/pan_pp.pytorch.
  
  Args:
      feature_dim (int): The dimension of the feature. Defaults to 4.
      delta_aggregation (float): The delta for aggregation. Defaults to 0.5.
      delta_discrimination (float): The delta for discrimination.
          Defaults to 1.5.
docstr: Compute the loss for a batch image.
  
  Args:
      emb (torch.Tensor): The embedding feature.
      instance (torch.Tensor): The instance feature.
      kernel (torch.Tensor): The kernel feature.
      training_mask (torch.Tensor): The effective mask.
docstr_tok: ["Compute","the","loss","for","a","batch","image",".","Args",":","emb","(","torch.Tensor",")",":","The","embedding","feature",".","instance","(","torch.Tensor",")",":","The","instance","feature",".","kernel","(","torch.Tensor",")",":","The","kernel","feature",".","training_mask","(","torch.Tensor",")",":","The","effective","mask","."]
code: def forward(
      self,
      emb: torch.Tensor,
      instance: torch.Tensor,
      kernel: torch.Tensor,
      training_mask: torch.Tensor,
  ) -> torch.Tensor:
      """Compute the loss for a batch image.
  
      Args:
          emb (torch.Tensor): The embedding feature.
          instance (torch.Tensor): The instance feature.
          kernel (torch.Tensor): The kernel feature.
          training_mask (torch.Tensor): The effective mask.
      """
      loss_batch = emb.new_zeros((emb.size(0)), dtype=torch.float32)
  
      for i in range(loss_batch.size(0)):
          loss_batch[i] = self._forward_single(
              emb[i], instance[i], kernel[i], training_mask[i]
          )
  
      return loss_batch
  
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 PANEmbLossV1 obj's underlying member method code with example usage: obj.forward(emb, instance, kernel, training_mask) and returns: loss_batch