code: def __init__(self, in_channels, out_channels_list, **kwargs):
      super().__init__()
      self.head_list = kwargs.pop("head_list")
  
      self.gtc_head = "sar"
      assert len(self.head_list) >= 2
      for idx, head_name in enumerate(self.head_list):
          name = list(head_name)[0]
          if name == "SARHead":
              # sar head
              sar_args = self.head_list[idx][name]
              self.sar_head = eval(name)(
                  in_channels=in_channels,
                  out_channels=out_channels_list["SARLabelDecode"],
                  **sar_args,
              )
          elif name == "NRTRHead":
              gtc_args = self.head_list[idx][name]
              max_text_length = gtc_args.get("max_text_length", 25)
              nrtr_dim = gtc_args.get("nrtr_dim", 256)
              num_decoder_layers = gtc_args.get("num_decoder_layers", 4)
              self.before_gtc = nn.Sequential(
                  nn.Flatten(2), FCTranspose(in_channels, nrtr_dim)
              )
              self.gtc_head = Transformer(
                  d_model=nrtr_dim,
                  nhead=nrtr_dim // 32,
                  num_encoder_layers=-1,
                  beam_size=-1,
                  num_decoder_layers=num_decoder_layers,
                  max_len=max_text_length,
                  dim_feedforward=nrtr_dim * 4,
                  out_channels=out_channels_list["NRTRLabelDecode"],
              )
          elif name == "CTCHead":
              # ctc neck
              self.encoder_reshape = Im2Seq(in_channels)
              neck_args = self.head_list[idx][name]["Neck"]
              encoder_type = neck_args.pop("name")
              self.ctc_encoder = SequenceEncoder(
                  in_channels=in_channels,
                  encoder_type=encoder_type,
                  **neck_args,
              )
              # ctc head
              head_args = self.head_list[idx][name]["Head"]
              self.ctc_head = eval(name)(
                  in_channels=self.ctc_encoder.out_channels,
                  out_channels=out_channels_list["CTCLabelDecode"],
                  **head_args,
              )
          else:
              raise NotImplementedError(
                  "{} is not supported in MultiHead yet".format(name)
              )
  
file_path: PaddleOCR/ppocr/modeling/heads/rec_multi_head.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import ParamAttr
  import paddle.nn
  import paddle.nn.functional
  from ppocr.modeling.necks.rnn import Im2Seq, EncoderWithRNN, EncoderWithFC, SequenceEncoder, EncoderWithSVTR
  from .rec_ctc_head import CTCHead
  from .rec_sar_head import SARHead
  from .rec_nrtr_head import Transformer
label_desc: Use image node_id 1 to create a new MultiHead object from inherited base classes: nn with example: obj = MultiHead(in_channels, out_channels_list)