docstr:     The inference wrapper for classification tasks.
  Parameters
  ----------
  cfg: dict
      The configure dictionary.
  model: nn.Module
      The model checkpoint.
      The model must support the following attributes:
          model.graph_name: str,
              The graph name, eg: "dependency".
      The model must support the following api:
          model.inference_forward(batch_graph, **kwargs)
              It is the forward process during inference.
          model.post_process()
              It is the post-process method.
      The inference wrapper will do the pipeline as follows:
          1. model.inference_forward()
          2. model.post_process()
      The output of the model.post_process should be the vector or matrix                 to contain the index of the class
  dataset: Dataset,
      The dataset class.
  data_item: DataItem,
      The data_item class.
  topology_builder: GraphConstructionBase, default=None
      The initial graph topology builder. It is used to custermize your own graph                 construction method. We will set the default topology builder for you                  if it is ``None`` according to ``graph_name`` in ``cfg``.
  dynamic_init_topology_builder: GraphConstructionBase, default=None
      The dynamic initial graph topology builder. It is used to custermize your own                 graph construction method. We will set the default topology builder for you                if it is ``None`` according to ``dynamic_init_graph_name`` in ``cfg``.
  lower_case: bool, default=True
  tokenizer: function, default=nltk.word_tokenize
  classification_label: the label tags which maps the classifier index
code: def __init__(
      self,
      cfg,
      model,
      dataset=Text2LabelDataset,
      data_item=Text2LabelDataItem,
      topology_builder=None,
      dynamic_init_topology_builder=None,
      lower_case=True,
      tokenizer=None,
      label_names=None,
  ):
      """
              The inference wrapper for classification tasks.
          Parameters
          ----------
          cfg: dict
              The configure dictionary.
          model: nn.Module
              The model checkpoint.
              The model must support the following attributes:
                  model.graph_name: str,
                      The graph name, eg: "dependency".
              The model must support the following api:
                  model.inference_forward(batch_graph, **kwargs)
                      It is the forward process during inference.
                  model.post_process()
                      It is the post-process method.
              The inference wrapper will do the pipeline as follows:
                  1. model.inference_forward()
                  2. model.post_process()
              The output of the model.post_process should be the vector or matrix \
                  to contain the index of the class
          dataset: Dataset,
              The dataset class.
          data_item: DataItem,
              The data_item class.
          topology_builder: GraphConstructionBase, default=None
              The initial graph topology builder. It is used to custermize your own graph\
                   construction method. We will set the default topology builder for you \
                   if it is ``None`` according to ``graph_name`` in ``cfg``.
          dynamic_init_topology_builder: GraphConstructionBase, default=None
              The dynamic initial graph topology builder. It is used to custermize your own \
                  graph construction method. We will set the default topology builder for you\
                  if it is ``None`` according to ``dynamic_init_graph_name`` in ``cfg``.
          lower_case: bool, default=True
          tokenizer: function, default=nltk.word_tokenize
          classification_label: the label tags which maps the classifier index
          """
      super().__init__(
          cfg=cfg,
          model=model,
          topology_builder=topology_builder,
          dynamic_init_topology_builder=dynamic_init_topology_builder,
          lower_case=lower_case,
          tokenizer=tokenizer,
          dataset=dataset,
          data_item=data_item,
      )
  
      self.label_names = label_names
      self.vocab_model = model.vocab_model
      self.data_item = data_item
  
file_path: graph4nlp/graph4nlp/pytorch/inference_wrapper/classifier_inference_wrapper.py
imports: import math
  import warnings
  from graph4nlp.pytorch.data.dataset import Text2LabelDataItem, Text2LabelDataset
  from graph4nlp.pytorch.modules.utils.generic_utils import all_to_cuda
  from .base import InferenceWrapperBase
label_desc: Use image node_id 1 to create a new ClassifierInferenceWrapper object from inherited base classes: InferenceWrapperBase with example: obj = ClassifierInferenceWrapper(cfg, model, dataset, data_item, topology_builder, dynamic_init_topology_builder, lower_case, tokenizer, label_names)