class_docstr: The implementation the loss of key information extraction proposed in
  the paper: `Spatial Dual-Modality Graph Reasoning for Key Information
  Extraction <https://arxiv.org/abs/2103.14470>`_.
  
  Args:
      weight_node (float): Weight of node loss. Defaults to 1.0.
      weight_edge (float): Weight of edge loss. Defaults to 1.0.
      ignore_idx (int): Node label to ignore. Defaults to -100.
code: def __init__(
      self,
      weight_node: float = 1.0,
      weight_edge: float = 1.0,
      ignore_idx: int = -100,
  ) -> None:
      super().__init__()
      # TODO: Use MODELS.build after DRRG loss has been merged
      self.loss_node = nn.CrossEntropyLoss(ignore_index=ignore_idx)
      self.loss_edge = nn.CrossEntropyLoss(ignore_index=-1)
      self.weight_node = weight_node
      self.weight_edge = weight_edge
      self.ignore_idx = ignore_idx
  
file_path: mmocr/mmocr/models/kie/module_losses/sdmgr_module_loss.py
imports: from typing import Dict, List, Tuple
  import torch
  from mmdet.models.losses import accuracy
  from torch import Tensor, nn
  from mmocr.registry import MODELS
  from mmocr.structures import KIEDataSample
label_desc: Use image node_id 1 to create a new SDMGRModuleLoss object from inherited base classes: nn with example: obj = SDMGRModuleLoss(weight_node, weight_edge, ignore_idx)