class_docstr: Decoder for RobustScanner.
  
  Args:
      dictionary (dict or :obj:`Dictionary`): The config for `Dictionary` or
          the instance of `Dictionary`.
      module_loss (dict, optional): Config to build module_loss. Defaults
          to None.
      postprocessor (dict, optional): Config to build postprocessor.
          Defaults to None.
      hybrid_decoder (dict): Config to build hybrid_decoder. Defaults to
          dict(type='SequenceAttentionDecoder').
      position_decoder (dict): Config to build position_decoder. Defaults to
          dict(type='PositionAttentionDecoder').
      fuser (dict): Config to build fuser. Defaults to
          dict(type='RobustScannerFuser').
      max_seq_len (int): Maximum sequence length. The
          sequence is usually generated from decoder. Defaults to 30.
      in_channels (list[int]): List of input channels.
          Defaults to [512, 512].
      dim (int): The dimension on which to split the input. Defaults to -1.
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to None.
class_docstr_tok: ["Decoder","for","RobustScanner",".","Args",":","dictionary","(","dict","or",":","obj",":","`","Dictionary","`",")",":","The","config","for","`","Dictionary","`","or","the","instance","of","`","Dictionary","`",".","module_loss","(","dict",",","optional",")",":","Config","to","build","module_loss",".","Defaults","to","None",".","postprocessor","(","dict",",","optional",")",":","Config","to","build","postprocessor",".","Defaults","to","None",".","hybrid_decoder","(","dict",")",":","Config","to","build","hybrid_decoder",".","Defaults","to","dict","(","type='SequenceAttentionDecoder","'",")",".","position_decoder","(","dict",")",":","Config","to","build","position_decoder",".","Defaults","to","dict","(","type='PositionAttentionDecoder","'",")",".","fuser","(","dict",")",":","Config","to","build","fuser",".","Defaults","to","dict","(","type='RobustScannerFuser","'",")",".","max_seq_len","(","int",")",":","Maximum","sequence","length",".","The","sequence","is","usually","generated","from","decoder",".","Defaults","to","30.","in_channels","(","list","[","int","]",")",":","List","of","input","channels",".","Defaults","to","[","512",",","512","]",".","dim","(","int",")",":","The","dimension","on","which","to","split","the","input",".","Defaults","to","-1.","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","configs",".","Defaults","to","None","."]
docstr: Forward for training.
  
  Args:
      feat (torch.Tensor, optional): The feature map from backbone of
          shape :math:`(N, E, H, W)`. Defaults to None.
      out_enc (torch.Tensor, optional): Encoder output. Defaults to None.
      data_samples (Sequence[TextRecogDataSample]): Batch of
          TextRecogDataSample, containing gt_text information. Defaults
          to None.
docstr_tok: ["Forward","for","training",".","Args",":","feat","(","torch.Tensor",",","optional",")",":","The","feature","map","from","backbone","of","shape",":","math",":","`","(","N",",","E",",","H",",","W",")","`",".","Defaults","to","None",".","out_enc","(","torch.Tensor",",","optional",")",":","Encoder","output",".","Defaults","to","None",".","data_samples","(","Sequence","[","TextRecogDataSample","]",")",":","Batch","of","TextRecogDataSample",",","containing","gt_text","information",".","Defaults","to","None","."]
code: def forward_train(
      self,
      feat: Optional[torch.Tensor] = None,
      out_enc: Optional[torch.Tensor] = None,
      data_samples: Optional[Sequence[TextRecogDataSample]] = None,
  ) -> torch.Tensor:
      """Forward for training.
  
      Args:
          feat (torch.Tensor, optional): The feature map from backbone of
              shape :math:`(N, E, H, W)`. Defaults to None.
          out_enc (torch.Tensor, optional): Encoder output. Defaults to None.
          data_samples (Sequence[TextRecogDataSample]): Batch of
              TextRecogDataSample, containing gt_text information. Defaults
              to None.
      """
      hybrid_glimpse = self.hybrid_decoder(feat, out_enc, data_samples)
      position_glimpse = self.position_decoder(
          feat, out_enc, data_samples
      )
      fusion_input = torch.cat(
          [hybrid_glimpse, position_glimpse], self.dim
      )
      outputs = self.linear_layer(fusion_input)
      outputs = self.glu_layer(outputs)
      return self.prediction(outputs)
  
file_path: mmocr/mmocr/models/textrecog/decoders/robust_scanner_fuser.py
imports: import warnings
  from typing import Dict, List, Optional, Sequence, Union
  import torch
  import torch.nn
  from mmocr.models.common.dictionary import Dictionary
  from mmocr.registry import MODELS
  from mmocr.structures import TextRecogDataSample
  from .base import BaseDecoder
label_desc: Use image node_id 2 for calling the RobustScannerFuser obj's underlying member method code with example usage: obj.forward_train(feat, out_enc, data_samples) and returns: self