class_docstr: Postprocessor for SDMGR. It converts the node and edge scores into
  labels and edge labels. If the link_type is not "none", it reconstructs the
  edge labels with different strategies specified by ``link_type``, which is
  generally known as the "openset" mode. In "openset" mode, only the edges
  connecting from "key" to "value" nodes will be constructed.
  
  Args:
      link_type (str): The type of link to be constructed.
          Defaults to 'none'. Options are:
  
          - 'none': The simplest link type involving no edge
            postprocessing. The edge prediction will be returned as-is.
          - 'one-to-one': One key node can be connected to one value node.
          - 'one-to-many': One key node can be connected to multiple value
            nodes.
          - 'many-to-one': Multiple key nodes can be connected to one value
            node.
          - 'many-to-many': No restrictions on the number of edges that a
            key/value node can have.
      key_node_idx (int, optional): The label index of the key node. It must
          be specified if ``link_type`` is not "none". Defaults to None.
      value_node_idx (int, optional): The index of the value node. It must be
          specified if ``link_type`` is not "none". Defaults to None.
code: def __init__(
      self,
      link_type: str = "none",
      key_node_idx: Optional[int] = None,
      value_node_idx: Optional[int] = None,
  ):
      assert link_type in [
          "one-to-one",
          "one-to-many",
          "many-to-one",
          "many-to-many",
          "none",
      ]
      self.link_type = link_type
      if link_type != "none":
          assert key_node_idx is not None and value_node_idx is not None
      self.key_node_idx = key_node_idx
      self.value_node_idx = value_node_idx
      self.softmax = nn.Softmax(dim=-1)
  
file_path: mmocr/mmocr/models/kie/postprocessors/sdmgr_postprocessor.py
imports: from typing import List, Optional, Tuple
  import numpy
  import torch
  from mmengine.structures import InstanceData
  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 SDMGRPostProcessor object  with example: obj = SDMGRPostProcessor(link_type, key_node_idx, value_node_idx)