code: def forward(self, x, targets=None):
      ctc_encoder = self.ctc_encoder(x)
      ctc_out = self.ctc_head(ctc_encoder, targets)
      head_out = dict()
      head_out["ctc"] = ctc_out
      head_out["ctc_neck"] = ctc_encoder
      # eval mode
      if not self.training:
          return ctc_out
      if self.gtc_head == "sar":
          sar_out = self.sar_head(x, targets[1:])
          head_out["sar"] = sar_out
      else:
          gtc_out = self.gtc_head(self.before_gtc(x), targets[1:])
          head_out["nrtr"] = gtc_out
      return head_out
  
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 2 for calling the MultiHead obj's underlying member method code with example usage: obj.forward(x, targets) and returns: head_out, ctc_out